function SystemAdminThemePreprocess::preprocessAdminBlockContent
Prepares variables for administrative content block templates.
Default template: admin-block-content.html.twig.
Parameters
array $variables: An associative array containing:
- content: List of administrative menu items. Each menu item contains:
- url: Path to the admin section.
- title: Short name of the section.
- description: Description of the administrative menu item.
- options: URL options. See \Drupal\Core\Url::fromUri() for details.
File
-
core/
modules/ system/ src/ Theme/ SystemAdminThemePreprocess.php, line 48
Class
- SystemAdminThemePreprocess
- Hook implementations for system.
Namespace
Drupal\system\ThemeCode
public function preprocessAdminBlockContent(array &$variables) : void {
if (!empty($variables['content'])) {
$variables['compact'] = system_admin_compact_mode();
foreach ($variables['content'] as $key => $item) {
$variables['content'][$key]['link'] = Link::fromTextAndUrl($item['title'], $item['url'])->toString();
if (!$variables['compact'] && !empty($item['description'])) {
$variables['content'][$key]['description'] = [
'#markup' => $item['description'],
];
}
else {
$variables['content'][$key]['description'] = FALSE;
}
}
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.