1 filter.admin.inc filter_admin_format_form_validate($form, &$form_state)

Form validation handler for filter_admin_format_form().

See also

filter_admin_format_form_submit()

File

core/modules/filter/filter.admin.inc, line 619
Admin page callbacks for the Filter module.

Code

function filter_admin_format_form_validate($form, &$form_state) {
  $format_format = trim($form_state['values']['format']);
  $format_name = trim($form_state['values']['name']);

  // Ensure that the values to be saved later are exactly the ones validated.
  form_set_value($form['format'], $format_format, $form_state);
  form_set_value($form['name'], $format_name, $form_state);

  $formats = filter_formats();
  foreach ($formats as $format) {
    if ($format->format !== $format_format && $format->name === $format_name) {
      form_set_error('name', t('Text format names must be unique. A format named %name already exists.', array('%name' => $format_name)));
    }
  }
}