function umami_preprocess_block

Same name and namespace in other branches
  1. 8.9.x core/profiles/demo_umami/themes/umami/umami.theme \umami_preprocess_block()
  2. 10 core/profiles/demo_umami/themes/umami/umami.theme \umami_preprocess_block()
  3. 11.x core/profiles/demo_umami/themes/umami/umami.theme \umami_preprocess_block()

Implements hook_preprocess_block().

File

core/profiles/demo_umami/themes/umami/umami.theme, line 48

Code

function umami_preprocess_block(&$variables) {
    $variables['title_attributes']['class'][] = 'block__title';
    // Add a class indicating the custom block bundle.
    if (isset($variables['elements']['content']['#block_content'])) {
        $variables['attributes']['class'][] = Html::getClass('block-type-' . $variables['elements']['content']['#block_content']->bundle());
    }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.