function toolbar_test_toolbar in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/toolbar/tests/modules/toolbar_test/toolbar_test.module \toolbar_test_toolbar()
Implements hook_toolbar().
File
- core/
modules/ toolbar/ tests/ modules/ toolbar_test/ toolbar_test.module, line 13 - A dummy module to test API interaction with the Toolbar module.
Code
function toolbar_test_toolbar() {
$items['testing'] = array(
'#type' => 'toolbar_item',
'tab' => array(
'#type' => 'link',
'#title' => t('Test tab'),
'#url' => Url::fromRoute('<front>'),
'#options' => array(
'attributes' => array(
'id' => 'toolbar-tab-testing',
'title' => t('Test tab'),
),
),
),
'tray' => array(
'#heading' => t('Test tray'),
'#wrapper_attributes' => array(
'id' => 'toolbar-tray-testing',
),
'content' => array(
'#theme' => 'item_list',
'#items' => array(
\Drupal::l(t('link 1'), new Url('<front>', [], array(
'attributes' => array(
'title' => 'Test link 1 title',
),
))),
\Drupal::l(t('link 2'), new Url('<front>', [], array(
'attributes' => array(
'title' => 'Test link 2 title',
),
))),
\Drupal::l(t('link 3'), new Url('<front>', [], array(
'attributes' => array(
'title' => 'Test link 3 title',
),
))),
),
'#attributes' => array(
'class' => array(
'toolbar-menu',
),
),
),
),
'#weight' => 50,
);
return $items;
}