function flag_form_validate in Flag 7.2
Same name and namespace in other branches
- 5 includes/flag.admin.inc \flag_form_validate()
- 6.2 includes/flag.admin.inc \flag_form_validate()
- 6 includes/flag.admin.inc \flag_form_validate()
- 7.3 includes/flag.admin.inc \flag_form_validate()
Add/Edit flag form validate.
File
- includes/
flag.admin.inc, line 533 - Contains administrative pages for creating, editing, and deleting flags.
Code
function flag_form_validate($form, &$form_state) {
$form_values = $form_state['values'];
if ($form_values['link_type'] == 'confirm') {
if (empty($form_values['flag_confirmation'])) {
form_set_error('flag_confirmation', t('A flag confirmation message is required when using the confirmation link type.'));
}
if (empty($form_values['unflag_confirmation'])) {
form_set_error('unflag_confirmation', t('An unflag confirmation message is required when using the confirmation link type.'));
}
}
$flag = $form['#flag'];
$flag
->form_input($form_values);
$errors = $flag
->validate();
foreach ($errors as $field => $field_errors) {
foreach ($field_errors as $error) {
form_set_error($field, $error['message']);
}
}
}