function seven_preprocess_menu_local_tasks

Same name in other branches
  1. 9 core/themes/seven/seven.theme \seven_preprocess_menu_local_tasks()

Implements hook_preprocess_HOOK() for menu-local-tasks templates.

Use preprocess hook to set #attached to child elements because they will be processed by Twig and drupal_render will be invoked.

File

core/themes/seven/seven.theme, line 36

Code

function seven_preprocess_menu_local_tasks(&$variables) {
    if (!empty($variables['primary'])) {
        $variables['primary']['#attached'] = [
            'library' => [
                'seven/drupal.nav-tabs',
            ],
        ];
    }
    elseif (!empty($variables['secondary'])) {
        $variables['secondary']['#attached'] = [
            'library' => [
                'seven/drupal.nav-tabs',
            ],
        ];
    }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.