Component

Block

Some extra's for block components.

 

Better classes

The classes on block has been changed to:

{%
  set classes = [
    'block',
    'block--' ~ configuration.provider|clean_class,
    'block--' ~ plugin_id|clean_class,
    'block--' ~ elements['#id']|clean_class,
  ]
%}

Which gives you the following classes:

.block {}
.block--my-custom-module {}
.block--my-block-id-block {}
.block--myblockid {} 

 

Extra functions

Create the possibility to have plugin-specific preprocess functions.

So inside block--page-title-block.theme you could now have this function:

<?php

/**
 * Implements template_preprocess_hook().
 */
function compony_preprocess_block__page_title_block(&$variables, $hook) {
  // Do custom preprocessing here, 
  // only for the page-title block. 
}

(Docs: Extending hooks yourself)

block
Drupal Core
Responsive
Accessible
HTML
34 downloads
horizontal beam No open issue