Wednesday, January 5, 2011

New hooks in drupal 7

New hooks: hook_modules_installed, hook_modules_enabled, hook_modules_disabled, and hook_modules_uninstalled

1.Four new hooks are provided so that other modules can react to modules' status changes. Each hook is passed an array of module short-names, i.e. array('blog', 'blogapi'). Note, these hooks should NOT be used by a module for its own installation or uninstallation; hook_install or hook_uninstall should be used. See the documentation for each hook for more information.

hook_modules_installed
hook_modules_enabled
hook_modules_disabled
hook_modules_uninstalled

New taxonomy hooks for term and vocabulary
New hooks are provided for taxonomy terms to allow modules to add information to the term object.

hook_taxonomy_term_load
hook_taxonomy_term_presave
hook_taxonomy_term_insert
hook_taxonomy_term_update
hook_taxonomy_term_delete
hook_taxonomy_vocabulary_load
hook_taxonomy_vocabulary_presave
hook_taxonomy_vocabulary_insert
hook_taxonomy_vocabulary_update
hook_taxonomy_vocabulary_delete

2.New hook: hook_username_alter()

3.New hooks: hook_admin_paths() and hook_admin_paths_alter()

New hooks are provided for indicating which paths on a Drupal site are associated with administrative actions. Modules should implement these hooks to specify any paths at which administration-related activities might be expected to occur. Note that pages which can be used interchangeably for both administrative and non-administrative purposes (for example, content creation pages) should be labeled administrative for the purposes of this hook.

It is not necessary for modules to use this hook to define administrative paths that live underneath the traditional admin/* location, since Drupal core already implements the hook to define these paths as administrative by default.

Other modules may use this information in a variety of ways - for example, to display administrative pages in a modal overlay, or in a different theme; the function path_is_admin() is provided for this purpose

No comments:

Post a Comment