diff --git a/core/core.api.php b/core/core.api.php index 134bb9855c1e7dc7419ee0fd2db054e198db47d2..b1fb3a2dd2767227037b08742197cbe1695cf049 100644 --- a/core/core.api.php +++ b/core/core.api.php @@ -2444,6 +2444,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 */ /**