You are here

function umami_preprocess_block in Drupal 10

Same name and namespace in other branches
  1. 8 core/profiles/demo_umami/themes/umami/umami.theme \umami_preprocess_block()
  2. 9 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
Functions to support theming in the Umami theme.

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());
  }
}