function mmenu_page_build in Mobile sliding menu 7.3
Same name and namespace in other branches
- 7 mmenu.module \mmenu_page_build()
- 7.2 mmenu.module \mmenu_page_build()
Implements hook_page_build().
File
- ./
mmenu.module, line 1070 - Primarily Drupal hooks and global API functions to manipulate mmenus.
Code
function mmenu_page_build(&$page) {
// Gets all mmenus markups and adds them to page.
$mmenus = mmenu_list();
$extensions = mmenu_extension_list();
$js_settings = array();
foreach ($mmenus as $mmenu) {
$name = $mmenu['name'];
// Checks if the mmenu was allowed to show.
if (mmenu_display_access($mmenu)) {
$page['page_bottom']['mmenu'][$name] = array(
'#theme' => 'mmenu',
'#mmenu' => $mmenu,
);
unset($mmenu['options']['navbarElements']);
foreach ($extensions as $extension) {
unset($mmenu['options'][$extension['name']]);
}
$js_settings[$name] = $mmenu;
}
}
// Outputs the mmenus settings as JSON, then we can do some custom
// stuffs in our own JS handlers.
if (count($js_settings) > 0) {
drupal_add_js(array(
'mmenu' => $js_settings,
), 'setting');
}
if (isset($page['page_bottom']['mmenu']) && count($page['page_bottom']['mmenu']) > 0) {
// Loads libraries.
$page['page_bottom']['mmenu']['#attached']['libraries_load'] = array(
'mmenu.hammer' => array(
'mmenu.hammer',
),
'mmenu.jquery.hammer' => array(
'mmenu.jquery.hammer',
),
'mmenu.main' => array(
'mmenu.main',
),
'mmenu.icomoon' => array(
'mmenu.icomoon',
),
);
}
}