Same name in other branches
  1. 8.x-1.x quicktabs.admin.inc \quicktabs_callback_element_validate()
1 string reference to 'quicktabs_callback_element_validate'
QuickCallbackContent::optionsForm dans plugins/QuickCallbackContent.inc
Method for returning the form elements to display for this tab type on the admin form.

Fichier

./quicktabs.admin.inc, line 467

Code

function quicktabs_callback_element_validate($element, &$form_state, $form) {
    // We can tell which tab delta the element is for from the element's #parents
    // property, which is an array based on the tree structure.
    $delta = $element['#parents'][1];
    if ($form_state['values']['tabs'][$delta]['type'] == 'callback') {
        if (empty($element['#value']) || url_is_external($element['#value'])) {
            form_error($element, t('You must specify a valid path.'));
        }
        if (strpos($element['#value'], '%') === 0) {
            form_error($element, t('"%" may not be used for the first segment of a path.'));
        }
        // automatically remove '/' from path.
        $form_state['values']['tabs'][$delta]['callback']['path'] = trim($form_state['values']['tabs'][$delta]['callback']['path'], '/');
    }
}