You are here

function template_preprocess_tb_megamenu_submenu in The Better Mega Menu 7

Same name and namespace in other branches
  1. 8 tb_megamenu.module \template_preprocess_tb_megamenu_submenu()
  2. 2.x tb_megamenu.module \template_preprocess_tb_megamenu_submenu()
1 string reference to 'template_preprocess_tb_megamenu_submenu'
tb_megamenu_theme in ./tb_megamenu.module
Implements hook_theme().

File

./tb_megamenu.themes.inc, line 179

Code

function template_preprocess_tb_megamenu_submenu(&$vars) {
  $parent = $vars['parent'];
  $mlid = $parent['link']['mlid'];
  $menu_config = $vars['menu_config'];
  $item_config = isset($menu_config[$mlid]) ? $menu_config[$mlid] : array();
  $submenu_config = isset($item_config['submenu_config']) ? $item_config['submenu_config'] : array();
  $vars['submenu_config'] = $submenu_config;
  tb_megamenu_edit_submenu_config($submenu_config);
  $rows = array();
  foreach ($item_config['rows_content'] as $row) {
    $rows[] = theme('tb_megamenu_row', array(
      'menu_name' => $vars['menu_name'],
      'row' => $row,
      'parent' => $vars['parent'],
      'level' => $vars['level'],
      'menu_config' => $vars['menu_config'],
      'block_config' => $vars['block_config'],
      'trail' => $vars['trail'],
      'section' => $vars['section'],
    ));
  }
  $vars['rows'] = implode("\n", $rows);
  if ($submenu_config['class'] != "") {
    $vars['classes_array'][] = $submenu_config['class'];
  }
  if ($submenu_config['group']) {
    $vars['classes_array'][] = 'mega-group-ct';
  }
  else {
    $vars['classes_array'][] = 'dropdown-menu';
    $vars['classes_array'][] = 'mega-dropdown-menu';
  }
  $vars['classes_array'][] = 'nav-child';
  $vars['attributes_array']['data-class'] = $submenu_config['class'];
  $vars['attributes_array']['data-width'] = $submenu_config['width'];
  if (!empty($submenu_config['width'])) {
    $vars['attributes_array']['style'] = "width: " . $submenu_config['width'] . "px;";
  }
}