Created
December 15, 2012 06:58
-
-
Save creynders/4291816 to your computer and use it in GitHub Desktop.
Example of how dynamic hook registration could be implemented
http://drupal.stackexchange.com/questions/53210/dynamic-hook-registration
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
function mymodule_pre_hook(){ | |
register_hook( 'mymodule_form_foo_node_form_alter', 'mymodule_handle_nodetype_form_alter' ); | |
register_hook( 'mymodule_form_baz_node_form_alter', 'mymodule_handle_nodetype_form_alter' ); | |
} | |
function mymodule_handle_nodetype_form_alter( &$form, &$form_state, $form_id ){ | |
//do what you need | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment