function views_ui_form_button_was_clicked

#process callback for a button; determines if a button is the form's triggering element.

The Form API has logic to determine the form's triggering element based on the data in $_POST. However, it only checks buttons based on a single #value per button. This function may be added to a button's #process callbacks to extend button click detection to support multiple #values per button. If the data in $_POST matches any value in the button's #values array, then the button is detected as having been clicked. This can be used when the value (label) of the same logical button may be different based on context (e.g., "Apply" vs. "Apply and continue").

See also

_form_builder_handle_input_element()

_form_button_was_clicked()

2 string references to 'views_ui_form_button_was_clicked'
ViewEditFormController::renderDisplayTop in drupal/core/modules/views/views_ui/lib/Drupal/views_ui/ViewEditFormController.php
Render the top of the display so it can be updated during ajax operations.
ViewUI::getStandardButtons in drupal/core/modules/views/views_ui/lib/Drupal/views_ui/ViewUI.php
Provide a standard set of Apply/Cancel/OK buttons for the forms. Also provide a hidden op operator because the forms plugin doesn't seem to properly provide which button was clicked.

File

drupal/core/modules/views/views_ui/admin.inc, line 2269
Provides the Views' administrative interface.

Code

function views_ui_form_button_was_clicked($element, &$form_state) {
  $process_input = empty($element['#disabled']) && ($form_state['programmed'] || $form_state['process_input'] && (!isset($element['#access']) || $element['#access']));
  if ($process_input && !isset($form_state['triggering_element']) && !empty($element['#is_button']) && isset($form_state['input'][$element['#name']]) && isset($element['#values']) && in_array($form_state['input'][$element['#name']], $element['#values'], TRUE)) {
    $form_state['triggering_element'] = $element;
  }
  return $element;
}