You are here

function cheeseburger_menu_block_view_alter in Cheeseburger Menu 5.0.x

Implements hook_block_view_alter().

File

./cheeseburger_menu.module, line 142
Contains cheeseburger_menu.module.

Code

function cheeseburger_menu_block_view_alter(array &$build, BlockPluginInterface $block) {
  if ($block
    ->getPluginId() === 'cheeseburger_menu') {
    if ($block
      ->getConfigValue('hidden')) {
      $build['#attributes']['style'] = 'display: none;';
    }
    else {
      $build['#attributes']['class'][] = 'block-cheeseburgermenu-container--is-open';
    }
    $build['#attributes']['class'][] = 'block-cheeseburgermenu-container';
    if ($block
      ->getConfigValue('show_navigation')) {
      $build['#attributes']['class'][] = 'block-cheeseburgermenu-container--with-navigation';
    }
    else {
      $build['#attributes']['class'][] = 'block-cheeseburgermenu-container--without-navigation';
    }
  }
  if ($block
    ->getPluginId() === 'cheeseburger_menu_trigger') {
    $variables['attributes']['class'][] = 'block-cheeseburgermenu-trigger-container';
  }
}