hook_taxonomy

Versions
4.6
hook_taxonomy($op, $type, $object)
4.7
hook_taxonomy($op, $type, $object = NULL)
5 – 6
hook_taxonomy($op, $type, $array = NULL)

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"
  • "form"

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

  • "term"
  • "vocabulary"

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

Return value

None for delete, insert and update. For operations "form", a $form object containing the form api elements that you wish to display on the form.

Related topics

Code

developer/hooks/core.php, line 963

<?php
function hook_taxonomy($op, $type, $object = NULL) {
  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']);
    }
  }
}
?>
Login or register to post comments
 
 

All source code and documentation on this site is released under the terms of the GNU General Public License, version 2 and later. Drupal is a registered trademark of Dries Buytaert.