Same name and namespace in other branches
  1. 5.x modules/filter/filter.module \filter_admin_format_form_validate()
  2. 6.x modules/filter/filter.admin.inc \filter_admin_format_form_validate()
  3. 7.x modules/filter/filter.admin.inc \filter_admin_format_form_validate()

Validate filter format form submissions.

File

modules/filter.module, line 464
Framework for handling filtering of content.

Code

function filter_admin_format_form_validate($form_id, $form_values) {
  if (!isset($form_values['format'])) {
    $name = trim($form_values['name']);
    $result = db_fetch_object(db_query("SELECT format FROM {filter_formats} WHERE name='%s'", $name));
    if ($result) {
      form_set_error('name', t('Filter format names need to be unique. A format named %name already exists.', array(
        '%name' => theme('placeholder', $name),
      )));
    }
  }
}