function template_preprocess_menu__uk_list in UIkit Components 8.2
Implements template_preprocess_HOOK() for menu--uk-list.html.twig.
File
- includes/
preprocess.inc, line 20 - Set up variables to be placed within the template (.html.twig) files.
Code
function template_preprocess_menu__uk_list(&$variables) {
$menu_name = $variables['menu_name'];
$menu_style = UIkitComponents::getMenuStyle($menu_name);
$nav_width_classes = UIkitComponents::getNavWidthClasses($menu_name);
$attributes = new Attribute();
$wrapper_attributes = new Attribute();
$attributes
->addClass('uk-list');
if ($menu_style && $menu_style != 'uk-list') {
$attributes
->addClass($menu_style);
}
if ($nav_width_classes) {
$classes = explode(' ', $nav_width_classes);
foreach ($classes as $class) {
$wrapper_attributes
->addClass($class);
}
}
$variables['attributes'] = $attributes;
$variables['wrapper_attributes'] = $wrapper_attributes;
}