function SystemManager::getBlockContents
Same name in other branches
- 9 core/modules/system/src/SystemManager.php \Drupal\system\SystemManager::getBlockContents()
- 8.9.x core/modules/system/src/SystemManager.php \Drupal\system\SystemManager::getBlockContents()
- 11.x core/modules/system/src/SystemManager.php \Drupal\system\SystemManager::getBlockContents()
Loads the contents of a menu block.
This function is often a destination for these blocks. For example, 'admin/structure/types' needs to have a destination to be valid in the Drupal menu system, but too much information there might be hidden, so we supply the contents of the block.
Return value
array A render array suitable for \Drupal\Core\Render\RendererInterface::render().
File
-
core/
modules/ system/ src/ SystemManager.php, line 156
Class
- SystemManager
- System Manager Service.
Namespace
Drupal\systemCode
public function getBlockContents() {
// We hard-code the menu name here since otherwise a link in the tools menu
// or elsewhere could give us a blank block.
$link = $this->menuActiveTrail
->getActiveLink('admin');
if ($link && ($content = $this->getAdminBlock($link))) {
$output = [
'#theme' => 'admin_block_content',
'#content' => $content,
];
}
else {
$output = [
'#markup' => t('You do not have any administrative items.'),
];
}
return $output;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.