You are here

function geysir_toolbar in Geysir 8

Implements hook_toolbar().

File

./geysir.module, line 29
Geysir module file.

Code

function geysir_toolbar() {
  $items = [];
  $items['geysir'] = [
    '#cache' => [
      'contexts' => [
        'user.permissions',
      ],
    ],
  ];
  if (!Drupal::currentUser()
    ->hasPermission('geysir manage paragraphs from front-end')) {
    return $items;
  }
  $items['geysir'] += [
    '#type' => 'toolbar_item',
    'tab' => [
      '#type' => 'html_tag',
      '#tag' => 'button',
      '#value' => t('Geysir'),
      '#attributes' => [
        'class' => [
          'toolbar-icon',
          'toolbar-icon-geysir',
        ],
        'aria-pressed' => 'false',
        'type' => 'button',
      ],
    ],
    '#wrapper_attributes' => [
      'class' => [
        'geysir-toolbar-tab',
      ],
    ],
    '#attached' => [
      'library' => [
        'geysir/geysir-toolbar',
      ],
    ],
  ];
  return $items;
}