function workbench_email_form_validate in Workbench Email 7.3
Same name and namespace in other branches
- 7 workbench_email.admin.inc \workbench_email_form_validate()
Validates the form values.
Parameters
array $form_state: The form_state array
File
- ./
workbench_email.admin.inc, line 322 - Administrative forms for Workbench Email Module.
Code
function workbench_email_form_validate($form, &$form_state) {
$workbench_emails = workbench_email_get();
foreach ($workbench_emails as $transition_label => $email_transition_set) {
foreach ($email_transition_set as $rid => $email_transition) {
if (isset($form_state['values']['emails'][$transition_label])) {
// Determine if subject is set with no message.
if ($form_state['values']['emails'][$transition_label][$rid]['subject'] != NULL && $form_state['values']['emails'][$transition_label][$rid]['message'] == NULL) {
form_set_error("{$transition_label}][{$rid}][message", t('You must add an email message if a subject is provided'));
}
// Determine if message is set with no subject.
if ($form_state['values']['emails'][$transition_label][$rid]['subject'] == NULL && $form_state['values']['emails'][$transition_label][$rid]['message'] != NULL) {
form_set_error("{$transition_label}][{$rid}][subject", t('You must add a subject if an email message is provided'));
}
}
}
}
}