Allow prioritization of the Drupal's hooks. Set weight for each hook in Drupal
is not so trivial as in other CMSs so, this plugin attempt to fix this.
FEATURES
Set weight for hook
Set weigth for hook auto and attached before/after other module
Set hook be to beginning or ending in the stack
EXAMPLES
Hooks are performed by a weight in ascending order.
Set function can be called without be in hook.
/**
* Implements hook_init().
*/
function mymodule_init() {
// do something.
}
// Set hook be performed in order where default weight is 0
hook_priority_set('mymodule_init', 100);
/**
* Implements hook_domain_delete().
*/
function mymodule_domain_delete() {
// do something.
}
// Set hook to be performed after the hook from module 'domain_conf'
hook_priority_set_after('mymodule_domain_delete', 'domain_conf');
Overview:
<?php
// Set pririty/weight for a hook to specific number.
hook_priority_set(string , int );
// Move hook to be performed as first.
hook_priority_set_first(string );