You are here

function claro_preprocess_admin_block_content in Drupal 10

Same name and namespace in other branches
  1. 8 core/themes/claro/claro.theme \claro_preprocess_admin_block_content()
  2. 9 core/themes/claro/claro.theme \claro_preprocess_admin_block_content()

Implements template_preprocess_HOOK() for admin_block.

File

core/themes/claro/claro.theme, line 203
Functions to support theming in the Claro theme.

Code

function claro_preprocess_admin_block_content(&$variables) {
  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']);
    }
  }
}