function node_expire_settings_form_validate in Node expire 5
Same name and namespace in other branches
- 6 node_expire.admin.inc \node_expire_settings_form_validate()
Implementation of hook_form_validate()
File
- ./
node_expire.module, line 310 - Alerts administrators of possibly outdated materials and optionally unpublishes them.
Code
function node_expire_settings_form_validate($form_id, $form_values) {
// Only validate the form if we're saving changes. We don't care about values if we're just resetting them anyway.
if ($form_values['op'] == t('Save configuration')) {
// Is the CC address valid?
if ($form_values['cc'] && !valid_email_address($form_values['cc'])) {
form_set_error('cc', t('The entered carbon copy address is invalid.'));
}
// Count instances of !start_section!
$matches = array();
preg_match_all('/!start_section!/', $form_values['body'], $matches);
if (count($matches[0]) > 1) {
form_set_error('body', t('The tag "!start_section!" can only be used once.'));
}
// Make sure instances of !start_section! match !stop_section!
$matches2 = array();
preg_match_all('/!stop_section!/', $form_values['body'], $matches2);
if (count($matches[0]) != count($matches2[0])) {
form_set_error('body', t('The tag "!stop_section!" is missing or doesn\'t match with "!start_section!".'));
}
}
}