diff --git a/core/lib/Drupal/Core/Render/Element/RenderElement.php b/core/lib/Drupal/Core/Render/Element/RenderElement.php index 802e05f1c4..d4c7ab383c 100644 --- a/core/lib/Drupal/Core/Render/Element/RenderElement.php +++ b/core/lib/Drupal/Core/Render/Element/RenderElement.php @@ -330,6 +330,7 @@ public static function preRenderAjaxForm($element) { // @todo Remove support for 'wrapper' and solely use 'wrapper_selector'. if (isset($settings['wrapper'])) { + @trigger_error('Use of "wrapper" is deprecated in Drupal 8.7.x and will be removed before Drupal 9.0.0. Use "wrapper_selector" instead and prefix the value with either "#" for IDs or "." for classes.', E_USER_DEPRECATED); $settings['wrapper_selector'] = '#' . $settings['wrapper']; unset($settings['wrapper']); } diff --git a/core/modules/action/tests/action_form_ajax_test/src/Plugin/Action/ActionAjaxTest.php b/core/modules/action/tests/action_form_ajax_test/src/Plugin/Action/ActionAjaxTest.php index 8afc98cf54..02075a1d28 100644 --- a/core/modules/action/tests/action_form_ajax_test/src/Plugin/Action/ActionAjaxTest.php +++ b/core/modules/action/tests/action_form_ajax_test/src/Plugin/Action/ActionAjaxTest.php @@ -50,7 +50,7 @@ public function buildConfigurationForm(array $form, FormStateInterface $form_sta '#type' => 'checkbox', '#title' => $this->t('Are we having a party?'), '#ajax' => [ - 'wrapper' => 'party-container', + 'wrapper_selector' => '#party-container', 'callback' => [$this, 'partyCallback'], ], '#default_value' => $having_a_party, diff --git a/core/modules/layout_builder/src/Plugin/Block/FieldBlock.php b/core/modules/layout_builder/src/Plugin/Block/FieldBlock.php index 88e608f6f4..3f8bb32565 100644 --- a/core/modules/layout_builder/src/Plugin/Block/FieldBlock.php +++ b/core/modules/layout_builder/src/Plugin/Block/FieldBlock.php @@ -251,7 +251,7 @@ public function blockForm($form, FormStateInterface $form_state) { '#default_value' => $config['formatter']['type'], '#ajax' => [ 'callback' => [static::class, 'formatterSettingsAjaxCallback'], - 'wrapper' => 'formatter-settings-wrapper', + 'wrapper_selector' => '#formatter-settings-wrapper', ], ]; diff --git a/core/modules/layout_builder/tests/modules/layout_builder_test/src/Plugin/Block/TestAjaxBlock.php b/core/modules/layout_builder/tests/modules/layout_builder_test/src/Plugin/Block/TestAjaxBlock.php index 1f1eeb0d7f..440921b0b3 100644 --- a/core/modules/layout_builder/tests/modules/layout_builder_test/src/Plugin/Block/TestAjaxBlock.php +++ b/core/modules/layout_builder/tests/modules/layout_builder_test/src/Plugin/Block/TestAjaxBlock.php @@ -32,7 +32,7 @@ public function blockForm($form, FormStateInterface $form_state) { '@time' => time(), ]), '#ajax' => [ - 'wrapper' => 'test-ajax-wrapper', + 'wrapper_selector' => '#test-ajax-wrapper', 'callback' => [$this, 'ajaxCallback'], ], ]; diff --git a/core/modules/media_library/src/Form/MediaLibraryUploadForm.php b/core/modules/media_library/src/Form/MediaLibraryUploadForm.php index ac250b1077..9cca26106b 100644 --- a/core/modules/media_library/src/Form/MediaLibraryUploadForm.php +++ b/core/modules/media_library/src/Form/MediaLibraryUploadForm.php @@ -215,7 +215,7 @@ public function buildForm(array $form, FormStateInterface $form_state) { '#submit' => ['::selectType'], '#ajax' => [ 'callback' => '::updateFormCallback', - 'wrapper' => 'media-library-upload-wrapper', + 'wrapper_selector' => '#media-library-upload-wrapper', ], '#limit_validation_errors' => [['files', $i, $type->id()]], ]; @@ -230,7 +230,7 @@ public function buildForm(array $form, FormStateInterface $form_state) { '#value' => $this->t('Save'), '#ajax' => [ 'callback' => '::updateWidget', - 'wrapper' => 'media-library-upload-wrapper', + 'wrapper_selector' => '#media-library-upload-wrapper', ], ]; } @@ -338,7 +338,7 @@ public function processUploadElement(array $element, FormStateInterface $form_st $element['upload_button']['#submit'] = ['::uploadButtonSubmit']; $element['upload_button']['#ajax'] = [ 'callback' => '::updateFormCallback', - 'wrapper' => 'media-library-upload-wrapper', + 'wrapper_selector' => '#media-library-upload-wrapper', ]; return $element; } diff --git a/core/modules/media_library/src/Plugin/Field/FieldWidget/MediaLibraryWidget.php b/core/modules/media_library/src/Plugin/Field/FieldWidget/MediaLibraryWidget.php index 22ac3ecb7a..c71e47e84f 100644 --- a/core/modules/media_library/src/Plugin/Field/FieldWidget/MediaLibraryWidget.php +++ b/core/modules/media_library/src/Plugin/Field/FieldWidget/MediaLibraryWidget.php @@ -192,7 +192,7 @@ public function formElement(FieldItemListInterface $items, $delta, array $elemen ], '#ajax' => [ 'callback' => [static::class, 'updateWidget'], - 'wrapper' => $wrapper_id, + 'wrapper_selector' => '#' . $wrapper_id, ], '#submit' => [[static::class, 'removeItem']], // Prevent errors in other widgets from preventing removal. @@ -297,7 +297,7 @@ public function formElement(FieldItemListInterface $items, $delta, array $elemen '#name' => $field_name . '-media-library-update' . $id_suffix, '#ajax' => [ 'callback' => [static::class, 'updateWidget'], - 'wrapper' => $wrapper_id, + 'wrapper_selector' => '#' . $wrapper_id, ], '#attributes' => [ 'data-media-library-widget-update' => $field_name . $id_suffix, diff --git a/core/modules/system/tests/modules/ajax_forms_test/src/Form/AjaxFormsTestAjaxElementsForm.php b/core/modules/system/tests/modules/ajax_forms_test/src/Form/AjaxFormsTestAjaxElementsForm.php index 41a9b6d92a..c657399ea8 100644 --- a/core/modules/system/tests/modules/ajax_forms_test/src/Form/AjaxFormsTestAjaxElementsForm.php +++ b/core/modules/system/tests/modules/ajax_forms_test/src/Form/AjaxFormsTestAjaxElementsForm.php @@ -39,7 +39,7 @@ public function buildForm(array $form, FormStateInterface $form_state) { '#type' => 'datetime', '#ajax' => [ 'callback' => [$callback_object, 'datetimeCallback'], - 'wrapper' => 'ajax_datetime_value', + 'wrapper_selector' => '#ajax_datetime_value', ], ]; diff --git a/core/modules/system/tests/modules/form_test/src/Form/FormTestMachineNameValidationForm.php b/core/modules/system/tests/modules/form_test/src/Form/FormTestMachineNameValidationForm.php index ff2dcaac58..4bf59dd3df 100644 --- a/core/modules/system/tests/modules/form_test/src/Form/FormTestMachineNameValidationForm.php +++ b/core/modules/system/tests/modules/form_test/src/Form/FormTestMachineNameValidationForm.php @@ -76,7 +76,7 @@ public function buildForm(array $form, FormStateInterface $form_state) { '#required' => TRUE, '#ajax' => [ 'callback' => '::buildAjaxSnackConfigureForm', - 'wrapper' => 'snack-config-form', + 'wrapper_selector' => '#snack-config-form', 'method' => 'replace', 'effect' => 'fade', ], diff --git a/core/modules/system/tests/modules/js_ajax_test/src/Form/JsAjaxTestForm.php b/core/modules/system/tests/modules/js_ajax_test/src/Form/JsAjaxTestForm.php index 567d4158d6..500a41458d 100644 --- a/core/modules/system/tests/modules/js_ajax_test/src/Form/JsAjaxTestForm.php +++ b/core/modules/system/tests/modules/js_ajax_test/src/Form/JsAjaxTestForm.php @@ -40,7 +40,7 @@ public function buildForm(array $form, FormStateInterface $form_state) { 'type' => 'throbber', 'message' => NULL, ], - 'wrapper' => 'js_ajax_test_form_wrapper', + 'wrapper_selector' => '#js_ajax_test_form_wrapper', ], ]; return $form;