Same name and namespace in other branches
  1. 4.7.x developer/hooks/core.php \hook_taxonomy()
  2. 5.x developer/hooks/core.php \hook_taxonomy()
  3. 6.x developer/hooks/core.php \hook_taxonomy()

Act on taxonomy changes.

This hook allows modules to take action when the terms and vocabularies in the taxonomy are modified.

Parameters

$op: What is being done to $object. Possible values:

  • "delete"
  • "insert"
  • "update"

$type: What manner of item $object is. Possible values:

  • "term"
  • "vocabulary"

$object: The item on which $op is being performed.

Return value

None.

Related topics

1 function implements hook_taxonomy()

Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.

forum_taxonomy in modules/forum.module
Implementation of hook_taxonomy().
10 invocations of hook_taxonomy()
blogapi_blogger_edit_post in modules/blogapi.module
Blogging API callback. Modifies the specified blog node.
blogapi_metaweblog_get_category_list in modules/blogapi.module
Blogging API callback. Returns a list of the taxonomy terms that can be associated with a blog node.
blogapi_mt_get_post_categories in modules/blogapi.module
Blogging API callback. Returns a list of the taxonomy terms that are assigned to a particular node.
blogapi_mt_set_post_categories in modules/blogapi.module
Blogging API callback. Assigns taxonomy terms to a particular node.
blogap_mti_publish_post in modules/blogapi.module
Blogging API callback. Publishes the given node

... See full list

File

developer/hooks/core.php, line 916
These are the hooks that are invoked by the Drupal core.

Code

function hook_taxonomy($op, $type, $object) {
  if ($type == 'vocabulary' && ($op == 'insert' || $op == 'update')) {
    if (variable_get('forum_nav_vocabulary', '') == '' && in_array('forum', $object['nodes'])) {

      // since none is already set, silently set this vocabulary as the navigation vocabulary
      variable_set('forum_nav_vocabulary', $object['vid']);
    }
  }
}