function mmenu_add_libraries in Mobile sliding menu 8
Generates the mmenu css list and adds to Drupal.
Parameters
array $variables: Render array from parent method.
1 call to mmenu_add_libraries()
- template_preprocess_mmenu in ./
mmenu.module - Processes variables for mmenu.tpl.php.
File
- ./
mmenu.module, line 583 - Primarily Drupal hooks and global API functions to manipulate mmenus.
Code
function mmenu_add_libraries(&$variables) {
$mmenu = $variables['mmenu'];
// Uses custom js handler if it is set.
if (isset($mmenu['custom']['library'])) {
foreach ($mmenu['custom']['library'] as $lib) {
$variables['#attached']['library'][] = $lib;
}
}
else {
$variables['#attached']['library'][] = 'mmenu/mmenu.default';
}
// Adds mmenu theme styles.
if (isset($mmenu['options']['classes'])) {
$themes = explode(' ', $mmenu['options']['classes']);
foreach ($themes as $theme) {
$mmenu_theme = mmenu_theme_list($theme);
if (isset($mmenu_theme['library'])) {
foreach ($mmenu_theme['library'] as $lib) {
$variables['#attached']['library'][] = $lib;
}
}
}
}
// Adds mmenu effect styles.
if (isset($mmenu['options']['effects'])) {
foreach ($mmenu['options']['effects'] as $k => $v) {
$mmenu_effect = mmenu_effect_list($k);
if (isset($mmenu_effect['library'])) {
foreach ($mmenu_effect['library'] as $lib) {
$variables['#attached']['library'][] = $lib;
}
}
}
}
}