diff --git a/core/lib/Drupal/Core/Form/FormBuilder.php b/core/lib/Drupal/Core/Form/FormBuilder.phpindex d94b9109b6..028396c909 100644--- a/core/lib/Drupal/Core/Form/FormBuilder.php+++ b/core/lib/Drupal/Core/Form/FormBuilder.php@@ -239,7 +239,7 @@ public function buildForm($form_id, FormStateInterface &$form_state) { // should be initialized to empty rather than to ['destination' => 'foo'].
$input = $form_state->getUserInput();
if (!isset($input)) {
- $input = $form_state->isMethodType('get') ? $request->query->all() : $request->request->all();+ $input = $request->isMethod('get') ? $request->query->all() : $request->request->all(); $form_state->setUserInput($input);
}
@@ -560,6 +560,16 @@ public function processForm($form_id, &$form, FormStateInterface &$form_state) { $unprocessed_form = $form;
$form = $this->doBuildForm($form_id, $form, $form_state);
+ // Allow an ajax callback while the form is operating in GET mode.+ // For example when using HOOK_form_views_exposed_form_alter.+ if ($form_state->isMethodType('get')) {+ $triggered = $this->requestStack->getCurrentRequest()->request->get('_triggering_element_name');+ if ($triggered && isset($form[$triggered]) && isset($form[$triggered]['#ajax'])) {+ $form_state->setTriggeringElement($form[$triggered]);+ throw new FormAjaxException($form, $form_state);+ }+ }+ // Only process the input if we have a correct form submission.
if ($form_state->isProcessingInput()) {
// Form values for programmed form submissions typically do not include a
Comments (0)
HTTPSSSH
You can clone a snippet to your computer for local editing.
Learn more.