How to automatically set a newly created menu as available so that it can immediately be used when configured for "the menu selected by the page"?

I've tried setting the 'menu_block_menu_order' variable through code, upon a new menu creation, but haven't figured it out.

What's the best way to automatically set a new menu , or all menus, as available?

  • did you clear the cache after creating the menu? – donquixote Sep 9 '14 at 17:15
  • Are you trying to add a new menu item in a custom module? – munkiepus Sep 9 '14 at 17:40
  • yes via a custom module or rules php. i don't think the menu block module offers ability to modify the menu_block_menu_order via it's hooks. – droopie Sep 9 '14 at 18:34

I'm not very familiar with the Menu Block module, but this seems to be the proper way of setting the menu_block_menu_order variable when a new menu is created:

function mymodule_menu_insert($menu) {
  $menus = variable_get('menu_block_menu_order', array('main-menu' => '', 'user-menu' => ''));
  $menus[$menu['menu_name']] = '';
  variable_set('menu_block_menu_order', $menus);
  • u dun it again! – droopie Sep 9 '14 at 21:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.