function UmamiHooks::preprocessBlockBundleBannerBlock

Same name and namespace in other branches
  1. 11.x core/profiles/demo_umami/themes/umami/src/Hook/UmamiHooks.php \Drupal\umami\Hook\UmamiHooks::preprocessBlockBundleBannerBlock()

Implements hook_preprocess_HOOK() for block--bundle--banner-block.

Attributes

#[Hook('preprocess_block__bundle__banner_block')]

File

core/profiles/demo_umami/themes/umami/src/Hook/UmamiHooks.php, line 80

Class

UmamiHooks
Hook implementations for umami.

Namespace

Drupal\umami\Hook

Code

public function preprocessBlockBundleBannerBlock(&$variables) : void {
  if (isset($variables['content']['field_content_link'])) {
    foreach (Element::children($variables['content']['field_content_link']) as $key) {
      $variables['content']['field_content_link'][$key]['#attributes']['class'][] = 'button';
      $variables['content']['field_content_link'][$key]['#attributes']['class'][] = 'button--primary';
      $variables['content']['field_content_link'][$key]['#attributes']['class'][] = 'banner__button';
    }
  }
}

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