Skip to content

Instantly share code, notes, and snippets.

@dooug
Forked from manumilou/main_menu.module
Last active August 29, 2015 14:10
Show Gist options
  • Save dooug/de2bdf59e068b3d40bb6 to your computer and use it in GitHub Desktop.
Save dooug/de2bdf59e068b3d40bb6 to your computer and use it in GitHub Desktop.
/**
* Implements hook_pre_features_revert().
*
* If a menu link is added in a menu handled by this feature, it won't be deleted when the menu feature is reverted.
* Only the menu links exported in the feature will be reverted.
* Implementing this hook allows us to make sure that the menu is fully resetted after the revert
* by first deleting all menu links before reverting.
*/
function main_menu_pre_features_revert($component) {
if($component == 'menu_links') {
// Delete all menu links before reverting
menu_delete_links('main-menu');
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment