function claro_preprocess_block

Same name in other branches
  1. 9 core/themes/claro/claro.theme \claro_preprocess_block()
  2. 8.9.x core/themes/claro/claro.theme \claro_preprocess_block()
  3. 10 core/themes/claro/claro.theme \claro_preprocess_block()

Implements hook_preprocess_block() for block content.

Disables contextual links for all blocks except for layout builder blocks.

File

core/themes/claro/claro.theme, line 216

Code

function claro_preprocess_block(&$variables) {
    if (isset($variables['title_suffix']['contextual_links']) && !isset($variables['elements']['#contextual_links']['layout_builder_block'])) {
        unset($variables['title_suffix']['contextual_links']);
        unset($variables['elements']['#contextual_links']);
        $variables['attributes']['class'] = array_diff($variables['attributes']['class'], [
            'contextual-region',
        ]);
    }
}

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