Created
January 25, 2016 12:17
-
-
Save leymannx/4df239a24353233582cc to your computer and use it in GitHub Desktop.
Lets your custom Drupal module run first or last. Uncomment the unneeded.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Implements hook_module_implements_alter(). | |
*/ | |
function MYMODULE_module_implements_alter(&$implementations, $hook) { | |
// run last | |
if ($hook == 'MYHOOK') { | |
$module = 'MYMODULE'; | |
$group = $implementations[$module]; | |
unset($implementations[$module]); | |
$implementations[$module] = $group; | |
} | |
// run first | |
if ($hook == 'MYHOOK') { | |
$module = 'MYMODULE'; | |
$group = array($module => $implementations[$module]); | |
unset($implementations[$module]); | |
$implementations = $group + $implementations; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment