Same name in other branches
  1. 7.x-2.x includes/admin.inc \quicktabs_form_validate()

Validation handler for quicktabs admin page.

Fichier

./quicktabs.admin.inc, line 447

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.'));
            }
        }
    }
}