hook_menu_alter

By Phil Frilling, 21 November, 2018

In a recent project, we were using an external service that pulls our site into their system and injects their content into our project. The issue we ran into was that the third party was overwriting all links in the template we provided with their HTTP host, causing the menu system from our Drupal site to break. To get around this we needed to generate absolute links for all of our menus.

In order to accomplish this we used template_preprocess() to dynamically provide our site's hostname as a variable:

By Phil Frilling, 9 November, 2016
In order to alter a menu item that is provided by a module/system, you can use hook_preprocess_menu__MENUNAME() (Since hook_menu_alter() no longer exists). In my instance, I need to change the system provided 'Logout' link to read 'Log Out'.