You are here

function flag_add_form_validate in Flag 6.2

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

File

includes/flag.admin.inc, line 246
Contains administrative pages for creating, editing, and deleting flags.

Code

function flag_add_form_validate($form, &$form_state) {
  $flag = flag_flag::factory_by_content_type($form_state['values']['type']);
  $flag->name = $form_state['values']['name'];
  $errors = $flag
    ->validate_name();
  foreach ($errors as $field => $field_errors) {
    foreach ($field_errors as $error) {
      form_set_error($field, $error['message']);
    }
  }
}