function om_menu_classes_get in OM Tools 6.2
Same name and namespace in other branches
- 8.2 tools/menu/menu.inc \om_menu_classes_get()
- 7.2 tools/menu/menu.inc \om_menu_classes_get()
default menus classes
1 call to om_menu_classes_get()
- om_menu_classes in tools/
menu/ menu.inc - Menu Classes Form
File
- tools/
menu/ menu.inc, line 46 - Menu Tools
Code
function om_menu_classes_get($menu_defaults = array(), $reset = FALSE) {
// default, module generated menus
$menu_sql = "SELECT c.menu_name, c.title, l.menu_name, l.router_path, l.link_title, l.mlid, l.hidden \n FROM {menu_custom} c \n INNER JOIN {menu_links} l \n WHERE c.menu_name = l.menu_name AND l.hidden >= 0 \n ORDER BY l.menu_name, l.link_title ASC";
$menu_result = db_query($menu_sql);
$new_menus = 0;
$current_menus = array();
while ($menu_record = db_fetch_object($menu_result)) {
$menu_group = $menu_record->menu_name;
$menu_title = $menu_record->link_title;
$link = om_tools_class_safe($menu_record->router_path);
$link = !$link ? 'default' : $link;
// new menus
if (!isset($menu_defaults['menu_classes_' . $menu_record->mlid]) || $reset == TRUE) {
$new_menus++;
$classes = 'menu-' . $menu_record->menu_name . '-' . $link;
}
else {
$classes = $menu_defaults['menu_classes_' . $menu_record->mlid];
}
// this will ignore non-existing menus
$current_menus[$menu_group]['menu_classes_' . $menu_record->mlid]['link_title'] = $menu_title;
$current_menus[$menu_group]['menu_classes_' . $menu_record->mlid]['menu_classes_' . $menu_record->mlid] = $classes;
$current_menus[$menu_group]['menu_classes_' . $menu_record->mlid]['mlid'] = $menu_record->mlid;
}
$new_menus > 1 ? $message = 'There are ' . $new_menus . ' new menus, save your settings to add these new blocks.' : ($message = 'There is ' . $new_menus . ' new menu, save your settings to add this new menu.');
if ($new_menus) {
drupal_set_message(t($message));
}
$current_menus['menu_classes_switch'] = isset($menu_defaults['menu_classes_switch']) ? $menu_defaults['menu_classes_switch'] : 0;
//dsm($current_menus);
ksort($current_menus);
return $current_menus;
}