You are here

function flag_form_validate in Flag 6

Same name and namespace in other branches
  1. 5 includes/flag.admin.inc \flag_form_validate()
  2. 6.2 includes/flag.admin.inc \flag_form_validate()
  3. 7.3 includes/flag.admin.inc \flag_form_validate()
  4. 7.2 includes/flag.admin.inc \flag_form_validate()

Add/Edit flag form validate.

File

includes/flag.admin.inc, line 368
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);
  $flag
    ->validate();
}