Skip to content

Instantly share code, notes, and snippets.

@creynders
Created December 15, 2012 06:58
Show Gist options
  • Save creynders/4291816 to your computer and use it in GitHub Desktop.
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
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