From 26a15a09af6b1a9fc1ef329bb08a83c5a9b840bb Mon Sep 17 00:00:00 2001
From: catch <catch@35733.no-reply.drupal.org>
Date: Wed, 22 Feb 2023 11:23:10 +0000
Subject: [PATCH] Issue #3324726 by Akhil Babu, xjm, Gauravvv, joachim: #ajax
 'options' property is undocumented

(cherry picked from commit 258cef9bed80d8c0fd01e3ac84b6baff40354ed4)
---
 core/core.api.php | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/core/core.api.php b/core/core.api.php
index 312af5e12c67..d42b5c776f02 100644
--- a/core/core.api.php
+++ b/core/core.api.php
@@ -2448,6 +2448,28 @@ function hook_validation_constraint_alter(array &$definitions) {
  *   autocomplete, as a \Symfony\Component\HttpFoundation\JsonResponse object.
  *   See the @link menu Routing topic @endlink for more information about
  *   routing.
+ *
+ * @section sec_query Query parameters in Ajax requests
+ * If a form uses an Ajax field, all the query parameters in the current request
+ * will be also added to the Ajax POST requests along with an additional
+ * 'ajax_form=1' parameter (See \Drupal\Core\Render\Element\RenderElement).
+ * @code
+ * $settings['options']['query'] += \Drupal::request()->query->all();
+ * $settings['options']['query'][FormBuilderInterface::AJAX_FORM_REQUEST] = TRUE;
+ * @endcode
+ *
+ * Form elements of type 'managed_file' will have an additional
+ * 'element_parents' query parameter in Ajax POST requests. This parameter will
+ * include the name of the element and its parents as per the render array.
+ * This helps to identify the position of the element in the form (See
+ * \Drupal\file\Element\ManagedFile).
+ * @code
+ * 'options' => [
+ *   'query' => [
+ *     'element_parents' => implode('/', $element['#array_parents']),
+ *   ],
+ * ],
+ * @endcode
  */
 
 /**
-- 
GitLab