function template_preprocess_we_megamenu_row in Drupal Mega Menu 8.x
Same name and namespace in other branches
- 8 we_megamenu.module \template_preprocess_we_megamenu_row()
Prepare variables for we_megamenu_row.
Parameters
array $vars variables are declared in theme.:
array $vars: Variables are declared in theme.
File
- ./
we_megamenu.module, line 463 - Drupal 8 Mega Menu Module.
Code
function template_preprocess_we_megamenu_row(array &$vars) {
$vars['attributes'] = new Attribute();
$vars['attributes']['class'] = [];
$vars['attributes']['class'][] = 'we-mega-menu-row';
$vars['attributes']['data-element-type'] = 'we-mega-menu-row';
if ($vars['item_config']) {
foreach ($vars['item_config'] as $key_col => $col) {
$vars['col'][] = [
'#theme' => 'we_megamenu_col',
'#items' => $vars['items'],
'#item_config' => $col,
'#section' => $vars['section'],
'#block_theme' => $vars['block_theme'],
'#menu_name' => $vars['menu_name'],
'#trail' => $vars['trail'],
];
$vars['attributes']['data-custom-row'] = isset(reset($col->col_content)->mlid) ? 0 : 1;
}
}
else {
$vars['col'] = [
'#theme' => 'we_megamenu_col',
'#items' => $vars['items'],
'#section' => $vars['section'],
'#block_theme' => $vars['block_theme'],
'#menu_name' => $vars['menu_name'],
'#trail' => $vars['trail'],
];
}
}