diff --git a/core/lib/Drupal/Core/Render/Element/RenderElement.php b/core/lib/Drupal/Core/Render/Element/RenderElement.php index a6e4492..73b4c36 100644 --- a/core/lib/Drupal/Core/Render/Element/RenderElement.php +++ b/core/lib/Drupal/Core/Render/Element/RenderElement.php @@ -129,11 +129,10 @@ public static function preRenderGroup($element) { * @see self::preRenderAjaxForm() */ public static function processAjaxForm(&$element, FormStateInterface $form_state, &$complete_form) { - $element = static::preRenderAjaxForm($element); - if (!empty($element['#ajax']['cache_form'])) { + if (!empty($element['#ajax']['url'])) { $form_state->setCached(); } - return $element; + return static::preRenderAjaxForm($element); } /** @@ -154,7 +153,6 @@ public static function processAjaxForm(&$element, FormStateInterface $form_state * - #ajax['parameters'] * - #ajax['effect'] * - #ajax['accepts'] - * - #ajax['cache_form'] * * @return array * The processed element with the necessary JavaScript attached to it. diff --git a/core/modules/file/src/Element/ManagedFile.php b/core/modules/file/src/Element/ManagedFile.php index d6f7419..4bfd6ca 100644 --- a/core/modules/file/src/Element/ManagedFile.php +++ b/core/modules/file/src/Element/ManagedFile.php @@ -145,9 +145,8 @@ public static function processManagedFile(&$element, FormStateInterface $form_st $element['#tree'] = TRUE; $ajax_settings = [ - 'url' => Url::fromRoute('file.ajax_upload'), // @todo Remove this in https://www.drupal.org/node/2500527. - 'cache_form' => TRUE, + 'url' => Url::fromRoute('file.ajax_upload'), 'options' => [ 'query' => [ 'element_parents' => implode('/', $element['#array_parents']), diff --git a/core/modules/system/tests/modules/ajax_forms_test/src/Form/AjaxFormsTestSimpleForm.php b/core/modules/system/tests/modules/ajax_forms_test/src/Form/AjaxFormsTestSimpleForm.php index 5289bcd..1f76850 100644 --- a/core/modules/system/tests/modules/ajax_forms_test/src/Form/AjaxFormsTestSimpleForm.php +++ b/core/modules/system/tests/modules/ajax_forms_test/src/Form/AjaxFormsTestSimpleForm.php @@ -71,9 +71,8 @@ public function buildForm(array $form, FormStateInterface $form_state) { '#options' => array('red' => 'red'), '#ajax' => array( 'callback' => $value, - // If the callback is NULL, the form will not post to the original URL - // and will expect the form to be cached. - 'cache_form' => $value === NULL, + // If the callback is NULL, the URL needs to be specified. + 'url' => $value === NULL ? Url::fromRoute('system.ajax') : NULL, ), ); } diff --git a/core/modules/views_ui/admin.inc b/core/modules/views_ui/admin.inc index 9cc4af8..7e07366 100644 --- a/core/modules/views_ui/admin.inc +++ b/core/modules/views_ui/admin.inc @@ -55,7 +55,6 @@ function views_ui_add_ajax_trigger(&$wrapping_element, $trigger_key, $refresh_pa // Specify the #ajax URL in order to retain form caching. // @todo Remove this in https://www.drupal.org/node/2500523. $triggering_element['#ajax']['url'] = Url::fromRoute('system.ajax'); - $triggering_element['#ajax']['cache_form'] = TRUE; // We do not use \Drupal\Component\Utility\Html::getUniqueId() to get an ID // for the AJAX wrapper, because it remembers IDs across AJAX requests (and