function views_ui_form_button_was_clicked

Same name and namespace in other branches
  1. 11.x core/modules/views_ui/admin.inc \views_ui_form_button_was_clicked()
  2. 10 core/modules/views_ui/admin.inc \views_ui_form_button_was_clicked()
  3. 9 core/modules/views_ui/admin.inc \views_ui_form_button_was_clicked()
  4. 8.9.x core/modules/views_ui/admin.inc \views_ui_form_button_was_clicked()

The #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").

Deprecated

in drupal:11.4.0 and is removed from drupal:13.0.0. There is no public replacement for this function. Form classes can use the \Drupal\views\ViewsFormHelperTrait trait and call the formButtonWasClicked() method.

See also

_form_builder_handle_input_element()

_form_button_was_clicked()

https://www.drupal.org/node/3566774

File

core/modules/views_ui/admin.inc, line 178

Code

function views_ui_form_button_was_clicked($element, FormStateInterface $form_state) {
  @trigger_error(__FUNCTION__ . '() is deprecated in drupal:11.4.0 and is removed from drupal:13.0.0. There is no public replacement for this function. Form classes can use the \\Drupal\\views\\ViewsFormHelperTrait trait and call the formButtonWasClicked() method. See https://www.drupal.org/node/3566774', E_USER_DEPRECATED);
  return _views_ui_wrap_views_form_helper_traits()::formButtonWasClicked($element, $form_state);
}

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