function content_taxonomy_autocomplete_validate_deny_new_terms in Content Taxonomy 7
Form element validate handler for taxonomy term autocomplete element, which denies any new terms.
1 string reference to 'content_taxonomy_autocomplete_validate_deny_new_terms'
File
- ./
content_taxonomy_autocomplete.module, line 135
Code
function content_taxonomy_autocomplete_validate_deny_new_terms($element, &$form_state, $form) {
$values = $form_state['values'];
if (!empty($element['#array_parents'])) {
foreach ($element['#array_parents'] as $parent) {
$values = $values[$parent];
}
}
foreach ($values as $delta => $value) {
if (isset($value['tid']) && $value['tid'] == 'autocreate') {
form_error($element, t('%name: new terms are not allowed. Please choose from the suggested options.', array(
'%name' => $element['#title'],
)));
}
}
}