function form_process_button

Processes a form button element.

Parameters

$element: An associative array containing the properties and children of the form button.

$form_state: The $form_state array for the form this element belongs to.

Return value

The processed element.

Related topics

1 string reference to 'form_process_button'
system_element_info in modules/system/system.module
Implements hook_element_info().

File

includes/form.inc, line 3395

Code

function form_process_button($element, &$form_state) {
    // We normally want to add drupal.form-single-submit so that the double submit
    // protection can be added to the site, however, with the addition of
    // javascript_always_use_jquery, this would make most pages with a login
    // block or a search form have jquery always added, changing what people who
    // set the javascript_always_use_jquery variable to FALSE would have expected.
    if (variable_get('javascript_always_use_jquery', TRUE) && variable_get('javascript_use_double_submit_protection', TRUE)) {
        $element['#attached']['library'][] = array(
            'system',
            'drupal.form-single-submit',
        );
    }
    return $element;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.