hook_taxonomy
developer/hooks/core.php, строка 1324
- Версии
- 5 – 6
hook_taxonomy($op, $type, $array = NULL)
Выполняется при изменениях таксономии.
This hook allows modules to take action when the terms and vocabularies in the taxonomy are modified.
Параметры
$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:
- 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
Возвращаемое значение
Нет.
Связанные темы
Код
<?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']);
}
}
}
?>
Войдите или зарегистрируйтесь, чтобы получить возможность отправлять комментарии