0

If you implement hook_page_alter in your own module, your hook will be called somewhere between all the other modules.

I am trying to undo something another module is doing in hook_page_alter. Somehow my hook is called before the other one.

How can I become the last hook to get called ? Or, what is the first hook after hook_page_alter that still uses $page ?

0

1 Answer 1

0

To make your hook last called you can make use of hook_module_implements_alter like the following:

function MODULENAME_module_implements_alter(&$implementations, $hook) {
  if ($hook == 'page_alter') {
    // Move MODULENAME_page_alter() to the end of the list. module_implements()
    $group = $implementations['MODULENAME'];
    unset($implementations['MODULENAME']);
    $implementations['MODULENAME'] = $group;
  }
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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