function Toolbar::getInfo
Same name in other branches
- 8.9.x core/modules/toolbar/src/Element/Toolbar.php \Drupal\toolbar\Element\Toolbar::getInfo()
- 10 core/modules/toolbar/src/Element/Toolbar.php \Drupal\toolbar\Element\Toolbar::getInfo()
- 11.x core/modules/toolbar/src/Element/Toolbar.php \Drupal\toolbar\Element\Toolbar::getInfo()
Overrides ElementInterface::getInfo
File
-
core/
modules/ toolbar/ src/ Element/ Toolbar.php, line 19
Class
- Toolbar
- Provides a render element for the default Drupal toolbar.
Namespace
Drupal\toolbar\ElementCode
public function getInfo() {
$class = static::class;
return [
'#pre_render' => [
[
$class,
'preRenderToolbar',
],
],
'#theme' => 'toolbar',
'#attached' => [
'library' => [
'toolbar/toolbar',
],
],
// Metadata for the toolbar wrapping element.
'#attributes' => [
// The id cannot be simply "toolbar" or it will clash with the
// simpletest tests listing which produces a checkbox with attribute
// id="toolbar".
'id' => 'toolbar-administration',
'role' => 'group',
'aria-label' => $this->t('Site administration toolbar'),
],
// Metadata for the administration bar.
'#bar' => [
'#heading' => $this->t('Toolbar items'),
'#attributes' => [
'id' => 'toolbar-bar',
'role' => 'navigation',
'aria-label' => $this->t('Toolbar items'),
],
],
];
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.