function megamenu_page_build in Megamenu 7
Implements hook_page_build().
We are adding the JavaScript and CSS here rather than theme_menu_tree() because when block caching is enabled none of it would get fired and the menus are unstyled.
File
- ./
megamenu.module, line 30 - Takes existing menus and produces blocks that render the menu as a megamenu.
Code
function megamenu_page_build(&$page) {
$path = drupal_get_path('module', 'megamenu');
// Add JavaScript.
drupal_add_js(array(
'megamenu' => array(
'timeout' => variable_get('megamenu_menu_timeout', 500),
'sizewait' => variable_get('megamenu_menu_sizewait', 500),
'hoverwait' => variable_get('megamenu_menu_hoverwait', 500),
),
), 'setting');
drupal_add_js($path . '/megamenu.js');
// Add main CSS functionality.
drupal_add_css($path . '/megamenu.css');
// Load default skins.
// @todo Don't load if custom skin (but not custom CSS)...
drupal_add_css($path . '/megamenu-skins.css');
//I THINK YOU SHOULD CONSIDER MOVING THIS
// Add custom CSS to extend or define skins: if exists.
/*
$customcsspath = file_directory_path() .'/megamenu/megamenu-custom.css';
if (file_exists($customcsspath)) {
drupal_add_css($customcsspath);
}
*/
}