You are here

function hook_cheeseburger_menu_item_alter in Cheeseburger Menu 5.0.x

Implements hook_cheeseburger_menu_item_alter().

1 invocation of hook_cheeseburger_menu_item_alter()
CheeseburgerMenuBlock::createMenuItemHooks in src/Plugin/Block/CheeseburgerMenuBlock.php
Invokes hooks on given menu items and its children.

File

./cheeseburger_menu.api.php, line 16
Hooks provided by the Cheeseburger menu module.

Code

function hook_cheeseburger_menu_item_alter(\Drupal\cheeseburger_menu\CheeseburgerMenuItem $cheeseburger_menu_item) {
  if ($cheeseburger_menu_item
    ->getOriginalEntityTypeId() === 'menu_link_content' && $cheeseburger_menu_item
    ->getOriginalEntityId() === 'menu_link_content:b59d109e-3800-4a2d-a8ee-170435ce05ed') {
    $cheeseburger_menu_item->attribute
      ->addClass('highlighted-menu-item');
  }
  if ($cheeseburger_menu_item
    ->getOriginalEntityTypeId() === 'taxonomy_term' && $cheeseburger_menu_item
    ->getOriginalEntityId() == '12') {
    $cheeseburger_menu_item->labelAttribute
      ->setAttribute('data-mrmot', 'example');
    $cheeseburger_menu_item->triggerAttribute
      ->addClass('highlighted-trigger-class');
  }
}