You are here

function template_preprocess_tb_megamenu_column in The Better Mega Menu 7

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

File

./tb_megamenu.themes.inc, line 238

Code

function template_preprocess_tb_megamenu_column(&$vars) {
  $col = $vars['col']['col_content'];
  $col_config = $vars['col']['col_config'];
  tb_megamenu_edit_col_config($col_config);
  $vars['col_config'] = $col_config;
  $vars['close_button'] = FALSE;
  $tb_items = array();
  foreach ($col as $tb_item) {
    if ($tb_item['type'] == 'menu_item') {
      $tb_items[] = theme('tb_megamenu_subnav', array(
        'menu_name' => $vars['menu_name'],
        'col' => $col,
        'items' => $vars['parent']['below'],
        'level' => $vars['level'],
        'menu_config' => $vars['menu_config'],
        'block_config' => $vars['block_config'],
        'trail' => $vars['trail'],
        'section' => $vars['section'],
      ));
      break;
    }
    else {
      $tb_items[] = theme('tb_megamenu_block', array(
        'block_key' => $tb_item['block_key'],
        'section' => $vars['section'],
        'showblocktitle' => $col_config['showblocktitle'],
      ));
      $vars['attributes_array']['data-showblocktitle'] = $col_config['showblocktitle'];
      if ($vars['section'] !== 'frontend') {
        $vars['close_button'] = '<span class="close fa fa-trash-o" title="' . t("Remove this block") . '">&nbsp;</span>';
      }
    }
  }
  $vars['tb_items'] = implode("\n", $tb_items);
  $vars['classes_array'][] = 'span' . $col_config['width'];
  $vars['classes_array'][] = ' mega-col-nav';
  if (!empty($col_config['class'])) {
    $vars['classes_array'][] = $col_config['class'];
  }
  if (!empty($col_config['hidewcol'])) {
    $vars['classes_array'][] = $col_config['class'];
  }
  if ($col_config['hidewcol']) {
    $vars['classes_array'][] = 'hidden-collapse';
  }
  $vars['attributes_array']['data-class'] = $col_config['class'];
  $vars['attributes_array']['data-width'] = $col_config['width'];
  $vars['attributes_array']['data-hidewcol'] = $col_config['hidewcol'];
  $vars['attributes_array']['id'] = tb_megamenu_get_counter("column");
}