function ClaroHooks::preprocessAdminBlockContent

Same name and namespace in other branches
  1. main core/themes/claro/src/Hook/ClaroHooks.php \Drupal\claro\Hook\ClaroHooks::preprocessAdminBlockContent()

Implements hook_preprocess_HOOK() for admin_block_content.

Attributes

#[Hook('preprocess_admin_block_content')]

File

core/themes/claro/src/Hook/ClaroHooks.php, line 213

Class

ClaroHooks
Hook implementations for claro.

Namespace

Drupal\claro\Hook

Code

public function preprocessAdminBlockContent(&$variables) : void {
  foreach ($variables['content'] as &$item) {
    $link_attributes = $item['url']->getOption('attributes') ?: [];
    $link_attributes['class'][] = 'admin-item__link';
    $item['url']->setOption('attributes', $link_attributes);
    $item['link'] = Link::fromTextAndUrl($item['title'], $item['url']);
    if (empty($item['description']) || empty($item['description']['#markup'])) {
      unset($item['description']);
    }
  }
}

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