You are here

public function NiceMenusBlock::_build_menu_style in Nice Menus 8

add class to nice menus.

Parameters

$tree:

$block_config:

Return value

mixed

1 call to NiceMenusBlock::_build_menu_style()
NiceMenusBlock::build in src/Plugin/Block/NiceMenusBlock.php

File

src/Plugin/Block/NiceMenusBlock.php, line 155

Class

NiceMenusBlock
Provides a 'Nice menus' block.

Namespace

Drupal\nice_menus\Plugin\Block

Code

public function _build_menu_style($tree, $block_config) {

  // add default class.
  $tree['#attributes']['class'][] = 'nice-menu';
  $tree['#attributes']['class'][] = 'nice-menu-' . $block_config['menu_name'];
  $tree['#attributes']['class'][] = 'nice-menu-' . $block_config['nice_menus_type'];
  $tree['#attributes']['class'][] = 'menu';

  // add 'menuparent' class.
  if (!empty($tree['#items'])) {
    $tree['#items'] = $this
      ->_build_sub_menu_menuparent($tree['#items']);
  }
  return $tree;
}