function _restrict_abusive_words_node_form_validate in Restrict Abusive Words 7
Same name and namespace in other branches
- 7.2 restrict_abusive_words.module \_restrict_abusive_words_node_form_validate()
Callback function to validate node form for abusive words.
File
- ./
restrict_abusive_words.module, line 248 - Restrict Abusive Words module.
Code
function _restrict_abusive_words_node_form_validate(&$form, &$form_state) {
if (isset($form_state['values'])) {
$search_string = _restrict_abusive_words_get_words_list();
foreach ($form_state['values'] as $key => $fields) {
$check_word = FALSE;
if (stripos($key, 'field_') !== FALSE || $key == 'body') {
if (count($fields[LANGUAGE_NONE]) > 0) {
foreach ($fields[LANGUAGE_NONE] as $f_key => $val) {
if (count($val) > 0) {
if (isset($val['value'])) {
$check_word = _restrict_abusive_words_search_words($search_string, $form_state['values'][$key][LANGUAGE_NONE][$f_key]['value']);
}
}
}
}
}
elseif ($key == 'title') {
$check_word = _restrict_abusive_words_search_words($search_string, $form_state['values'][$key]);
}
if ($check_word !== FALSE) {
_restrict_abusive_words_validation_message($key, $check_word);
}
}
}
}