You are here

function wysiwyg_profile_overview_validate in Wysiwyg 6.2

Same name and namespace in other branches
  1. 7.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 752
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 {
    $profile = wysiwyg_profile_load($new['name']);
    if (!empty($profile)) {
      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.'));
    }
  }
}