You are here

function wysiwyg_profile_overview_validate in Wysiwyg 7.2

Same name and namespace in other branches
  1. 6.2 wysiwyg.admin.inc \wysiwyg_profile_overview_validate()

Validate callback for Wysiwyg profile overview form.

See also

wysiwyg_profile_overview()

File

./wysiwyg.admin.inc, line 751
Integrate Wysiwyg editors into Drupal.

Code

function wysiwyg_profile_overview_validate($form, &$form_state) {
  $new = $form_state['values']['formats']['_new_profile'];
  if (empty($new['name'])) {
    form_set_error('formats][new][name', t('You must select a format.'));
  }
  else {
    $profiles = wysiwyg_profile_load_all();
    if (isset($profiles[$new['name']]) && !empty($profiles[$new['name']]->editor)) {
      form_set_error('formats][new][name', t('An editor is already assigned to this format.'));
    }
  }
  if (empty($new['editor'])) {
    form_set_error('formats][new][editor', t('You must select an editor.'));
  }
  else {
    $editor = wysiwyg_get_editor($form_state['values']['formats']['_new_profile']['editor']);
    if (empty($editor)) {
      form_set_error('formats][new][editor', t('The selected editor was not found.'));
    }
  }
}