You are here

function cookiebot_preprocess_menu in Cookiebot - Cookie consent, Cookie monitoring and Cookie control 8

Implements template_preprocess_menu().

Adds the 'cookiebot-renew' class to the menu link with '/cookiebot-renew' URL to re-open cookiebot popup.

File

./cookiebot.module, line 175
The module file.

Code

function cookiebot_preprocess_menu(&$vars) {
  if (empty($vars['items'])) {
    return;
  }
  foreach ($vars['items'] as &$item) {
    if ($item['url']
      ->toString() === '/cookiebot-renew') {

      /** @var \Drupal\Core\Template\Attribute $attributes */
      $attributes = $item['attributes'];
      $attributes
        ->addClass('cookiebot-renew');
    }
  }
}