| 4.6 core.php | hook_taxonomy($op, $type, $object) |
| 4.7 core.php | hook_taxonomy($op, $type, |
| 5 core.php | hook_taxonomy($op, $type, $array = NULL) |
| 6 core.php | 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 $array. Possible values:
- "delete"
- "insert"
- "update"
$type: What manner of item $array is. Possible values:
- "term"
- "vocabulary"
$array: The item on which $op is being performed. Possible values:
- for vocabularies, 'insert' and 'update' ops: $form_values from taxonomy_form_vocabulary_submit()
- for vocabularies, 'delete' op: $vocabulary from taxonomy_get_vocabulary() cast to an array
- for terms, 'insert' and 'update' ops: $form_values from taxonomy_form_term_submit()
- for terms, 'delete' op: $term from taxonomy_get_term() cast to an array
Return value
None.
Related topics
2 functions implement 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/ forum.module - Implementation of hook_taxonomy().
- trigger_taxonomy in modules/
trigger/ trigger.module - Implementation of hook_taxonomy().
10 invocations of hook_taxonomy()
- blogapi_metaweblog_get_category_list in modules/
blogapi/ 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/ blogapi.module - Blogging API callback. Returns a list of the taxonomy terms that are assigned to a particular node.
- hook_search in developer/
hooks/ core.php - Define a custom search routine.
- node_filters in modules/
node/ node.admin.inc - List node administration filters that can be applied.
- node_filter_form in modules/
node/ node.admin.inc - Return form for node administration filters.
File
- developer/
hooks/ core.php, line 2088 - These are the hooks that are invoked by the Drupal core.
Code
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']);
}
}
}