function mmenu_page_build in Mobile sliding menu 7
Same name and namespace in other branches
- 7.3 mmenu.module \mmenu_page_build()
- 7.2 mmenu.module \mmenu_page_build()
Implements hook_page_build().
File
- ./
mmenu.module, line 751 - 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();
foreach ($mmenus as $mmenu) {
$name = $mmenu['name'];
// Checks if the mmenu was enabled.
if (isset($mmenu['enabled']) && $mmenu['enabled']) {
$page['page_bottom']['mmenu'][$name] = array(
'#theme' => 'mmenu',
'#mmenu' => $mmenu,
'#attached' => array(
// Outputs the mmenus settings as JSON, then we can do some custom
// stuffs in our own JS handlers.
'js' => array(
array(
'data' => array(
'mmenus' => array(
$name => $mmenu,
),
),
'type' => 'setting',
),
),
),
);
}
}
if (isset($page['page_bottom']['mmenu']) && count($page['page_bottom']['mmenu']) > 0) {
// Loads libraries.
$page['page_bottom']['mmenu']['#attached']['libraries_load'] = array(
'mmenu.main' => array(
'mmenu.main',
),
'mmenu.hammer' => array(
'mmenu.hammer',
),
'mmenu.jquery.hammer' => array(
'mmenu.jquery.hammer',
),
);
}
}