1

I've used Mobile sliding menu module version 7.x-1.0-dev.

We can change menu link using theme_menu_link().

Similarly is any other hook for change menu link in this module?

1

You want to implement hook_translated_menu_link_alter() and hook_menu_link_alter(&$item). This hook is not called for all menu items.

According to the API documentation:

It is only invoked if $item['options']['alter'] has been set to a non-empty value (e.g., TRUE). This flag should be set using hook_menu_link_alter(). Here's an example:

function MODULE_menu_link_alter(&$link) {
  if ($link['link_title'] == 'foo') {
    $link['options']['alter'] = TRUE;
  }
}

function MODULE_translated_menu_link_alter(&$link) {
  if ($link['link_title'] == 'foo') {
    $link['href'] = 'node/5';
  }
}

Some notes

You may want to filter additionally by $link['menu_name']; MODULE_menu_link_alter() is invoked on cache clear for all menus items declared via hook_menu(). For menu items created via web it is only invoked on save, that is, for this code to take effect you need to edit-and-save menu links you want to alter.

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.