You are here

function popup_ui_form_formatters_validate in Popup 7

Same name and namespace in other branches
  1. 8 modules/popup_ui/includes/popup_ui.admin.inc \popup_ui_form_formatters_validate()
  2. 7.x modules/popup_ui/includes/popup_ui.admin.inc \popup_ui_form_formatters_validate()
  3. 6.x modules/popup_ui/includes/popup_ui.admin.inc \popup_ui_form_formatters_validate()

File

modules/popup_ui/includes/popup_ui.admin.inc, line 319

Code

function popup_ui_form_formatters_validate(&$form, &$form_state) {
  $values = $form_state['values'];
  $formatters = _popup_ui_formatter_settings();
  unset($values['popup_formats']['popup_formats__active_tab']);
  foreach ($values['format_forms'] as $label => $fieldset) {
    $row = $fieldset['fieldset']['fields'];
    if (!preg_match('/^[A-Za-z0-9\\ ]*$/', $row['label'])) {
      form_set_error('popup_formats][' . $label . '][label', t('Labels may only contain letters, numbers and spaces.'));
    }
    if (!$row['label'] && $label != 'new') {
      form_set_error('popup_formats][' . $label . '][label', t('Please provide a label.'));
    }
  }
}