You are here

function menu_test_menu_local_tasks_alter in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 core/modules/system/tests/modules/menu_test/menu_test.module \menu_test_menu_local_tasks_alter()

Implements hook_menu_local_tasks_alter().

File

core/modules/system/tests/modules/menu_test/menu_test.module, line 33
Module that implements various hooks for menu tests.

Code

function menu_test_menu_local_tasks_alter(&$data, $route_name, RefinableCacheableDependencyInterface &$cacheability) {
  if (in_array($route_name, array(
    'menu_test.tasks_default',
  ))) {
    $data['tabs'][0]['foo'] = array(
      '#theme' => 'menu_local_task',
      '#link' => array(
        'title' => "Task 1 <script>alert('Welcome to the jungle!')</script>",
        'url' => Url::fromRoute('menu_test.router_test1', array(
          'bar' => '1',
        )),
      ),
      '#weight' => 10,
    );
    $data['tabs'][0]['bar'] = array(
      '#theme' => 'menu_local_task',
      '#link' => array(
        'title' => 'Task 2',
        'url' => Url::fromRoute('menu_test.router_test2', array(
          'bar' => '2',
        )),
      ),
      '#weight' => 20,
    );
  }
  $cacheability
    ->addCacheTags([
    'kittens:dwarf-cat',
  ]);
}