hook_taxonomy

Definition

hook_taxonomy($op, $type, $array = NULL)
developer/hooks/core.php, line 1190

Description

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"
$array The item on which $op is being performed. Possible values:

Return value

None.

Related topics

Namesort iconDescription
HooksAllow modules to interact with the Drupal core.

Code

<?php
function hook_taxonomy($op, $type, $array = NULL) {
  if ($type == 'vocabulary' && ($op == 'insert' || $op == 'update')) {
    if (variable_get('forum_nav_vocabulary', '') == ''
        && in_array('forum', $array['nodes'])) {
      // since none is already set, silently set this vocabulary as the
      // navigation vocabulary
      variable_set('forum_nav_vocabulary', $array['vid']);
    }
  }
}
?>
 
 

Drupal is a registered trademark of Dries Buytaert.