Skip to content

Instantly share code, notes, and snippets.

@leymannx
Created January 25, 2016 12:17
Show Gist options
  • Save leymannx/4df239a24353233582cc to your computer and use it in GitHub Desktop.
Save leymannx/4df239a24353233582cc to your computer and use it in GitHub Desktop.
Lets your custom Drupal module run first or last. Uncomment the unneeded.
/**
* 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