You are here

function quicktabs_form_validate in Quick Tabs 7.3

Same name and namespace in other branches
  1. 5 quicktabs.module \quicktabs_form_validate()
  2. 6.3 includes/admin.inc \quicktabs_form_validate()
  3. 6 quicktabs.module \quicktabs_form_validate()
  4. 6.2 includes/admin.inc \quicktabs_form_validate()
  5. 7.2 includes/admin.inc \quicktabs_form_validate()

Validation handler for quicktabs admin page.

File

./quicktabs.admin.inc, line 447
Provides the Quicktabs administrative interface.

Code

function quicktabs_form_validate($form, &$form_state) {
  if (empty($form_state['values']['machine_name'])) {
    form_set_error('machine_name', t('The quicktabs machine name is required.'));
  }
  elseif (!preg_match('!^[a-z0-9_]+$!', $form_state['values']['machine_name'])) {
    form_set_error('machine_name', t('The quicktabs machine name must contain only lowercase letters, numbers, and underscores.'));
  }
  if (!isset($form_state['values']['tabs'])) {
    form_set_error('', t('At least one tab should be created.'));
  }
  else {
    foreach ($form_state['values']['tabs'] as $j => $tab) {
      if (empty($tab['title'])) {
        form_set_error('tabs][' . $j . '][title', t('Title is required for each tab.'));
      }
    }
  }
}