Node

Some extra's for node components.

Better classes

The classes on node has been changed to:

{%
  set classes = [
    'node',
    'node--type-' ~ node.bundle|clean_class,
    node.bundle|clean_class,
    node.isPromoted() ? node.bundle|clean_class ~ '--promoted',
    node.isSticky() ? node.bundle|clean_class ~ '--sticky',
    not node.isPublished() ? node.bundle|clean_class ~ '--unpublished',
    view_mode ? node.bundle|clean_class ~ '--' ~ view_mode|clean_class,
  ]
%}

Which gives you the following classes:

.node {}
.node--type--faq {}
.faq {}
.faq--promoted {} 
.faq--sticky {} 
.faq--unpublished {} 
.faq--full {} 

Extra functions

Create the possibility to have content-type-specific preprocess functions.

So inside node--faq.theme you could now have this function:

<?php

/**
 * Implements template_preprocess_hook().
 */
function compony_preprocess_node__faq(&$variables, $hook) {
  // Do custom preprocessing here, 
  // only for FAQ nodes. 
}

(Docs: Extending hooks yourself)

Specifications

Machine name

node

Built upon

Drupal Core

Perks

Responsive
Accessible

Building blocks

HTML

Stats

Public component
119 downloads
No open issue

Contributors