Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. Toolbar.php

function 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\Element

Code

public function getInfo() {
    $class = static::class;
    return [
        '#pre_render' => [
            [
                $class,
                'preRenderToolbar',
            ],
        ],
        '#theme' => 'toolbar',
        '#attached' => [
            'library' => [
                'toolbar/toolbar',
            ],
        ],
        // Metadata for the toolbar wrapping element.
'#attributes' => [
            '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'),
            ],
        ],
    ];
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal