Inicio › API reference ›
hook_taxonomy
hooks/core.php, line 1711
- Versions
- hooks
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"
- "term"
- "vocabulary"
- 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
Valor de retorno
None.
Código
<?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']);
}
}
}
?> 
Comentarios recientes
hace 17 horas 50 mins
hace 1 día 10 horas
hace 1 semana 21 horas
hace 14 semanas 4 días
hace 19 semanas 19 horas
hace 20 semanas 2 días
hace 20 semanas 5 días
hace 20 semanas 5 días
hace 21 semanas 2 días
hace 22 semanas 1 día