function claro_preprocess_admin_block_content

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

Implements template_preprocess_HOOK() for admin_block.

File

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

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']);
        }
    }
}

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