You are here

function content_calendar_toolbar_alter in Content Planner 8

Implements hook_toolbar_alter().

File

modules/content_calendar/content_calendar.module, line 130
Contains content_calendar.module.

Code

function content_calendar_toolbar_alter(&$items) {
  $links =& $items['content_planner']['tray']['links']['#items'];
  if (\Drupal::currentUser()
    ->hasPermission('manage content calendar') || \Drupal::currentUser()
    ->hasPermission('view content calendar') || \Drupal::currentUser()
    ->hasPermission('administer content calendar settings')) {
    $links['content_calendar'] = [
      '#type' => 'link',
      '#title' => t('Content Calendar'),
      '#url' => Url::fromRoute('content_calendar.current'),
      '#attributes' => [
        'class' => 'toolbar-icon toolbar-icon-system-admin-content',
      ],
    ];
  }
}