forum_validate
modules/forum/forum.module, строка 354
- Версии
- 5
forum_validate($node)
Implementation of hook_validate()
.
Check in particular that only a 'leaf'
term in the associated taxonomy
vocabulary is selected, not a 'container'
term.
Код
<?php
function forum_validate($node) {
if ($node->taxonomy) {
// Extract the node's proper topic ID.
$vocabulary = variable_get('forum_nav_vocabulary', '');
$containers = variable_get('forum_containers', array());
foreach ($node->taxonomy as $term) {
if (db_result(db_query('SELECT COUNT(*) FROM {term_data} WHERE tid = %d AND vid = %d', $term, $vocabulary))) {
if (in_array($term, $containers)) {
$term = taxonomy_get_term($term);
form_set_error('taxonomy', t('The item %forum is only a container for forums. Please select one of the forums below it.', array('%forum' => $term->name)));
}
}
}
}
}
?>
Войдите или зарегистрируйтесь, чтобы получить возможность отправлять комментарии