diff --git a/core/core.api.php b/core/core.api.php index 0cfea5b8c9..ee977619ec 100644 --- a/core/core.api.php +++ b/core/core.api.php @@ -2373,16 +2373,16 @@ function hook_validation_constraint_alter(array &$definitions) { * Ajax event. More information on callbacks is below in @ref sub_callback. * - wrapper: The HTML 'id' attribute of the area where the content returned by * the callback should be placed. Note that callbacks have a choice of - * returning content or JavaScript commands; 'wrapper' is used for content + * returning content or JavaScript commands; 'selector' is used for content * returns. * - method: The jQuery method for placing the new content (used with - * 'wrapper'). Valid options are 'replaceWith' (default), 'append', 'prepend', + * 'selector'). Valid options are 'replaceWith' (default), 'append', 'prepend', * 'before', 'after', or 'html'. See * http://api.jquery.com/category/manipulation/ for more information on these * methods. * - effect: The jQuery effect to use when placing the new HTML (used with - * 'wrapper'). Valid options are 'none' (default), 'slide', or 'fade'. - * - speed: The effect speed to use (used with 'effect' and 'wrapper'). Valid + * 'selector'). Valid options are 'none' (default), 'slide', or 'fade'. + * - speed: The effect speed to use (used with 'effect' and 'selector'). Valid * options are 'slow' (default), 'fast', or the number of milliseconds the * effect should run. * - event: The JavaScript event to respond to. This is selected automatically @@ -2424,8 +2424,8 @@ function hook_validation_constraint_alter(array &$definitions) { * Once you have processed the input, you have your choice of returning HTML * markup or a set of Ajax commands. If you choose to return HTML markup, you * can return it as a string or a renderable array, and it will be placed in - * the defined 'wrapper' element (see documentation above in @ref sub_form). - * In addition, any messages returned by + * the defined 'selector' element (see documentation above in + * @ref sub_form). In addition, any messages returned by * \Drupal\Core\Messenger\Messenger::all(), themed as in * status-messages.html.twig, will be prepended. * @@ -2449,7 +2449,7 @@ function hook_validation_constraint_alter(array &$definitions) { * invokes an arbitrary jQuery command. * * As noted above, status messages are prepended automatically if you use the - * 'wrapper' method and return HTML markup. This is not the case if you return + * 'selector' method and return HTML markup. This is not the case if you return * commands, but if you would like to show status messages, you can add * @code * array('#type' => 'status_messages') diff --git a/core/lib/Drupal/Core/Field/Plugin/Field/FieldType/EntityReferenceItem.php b/core/lib/Drupal/Core/Field/Plugin/Field/FieldType/EntityReferenceItem.php index bf638a33c3..fe9decb7ac 100644 --- a/core/lib/Drupal/Core/Field/Plugin/Field/FieldType/EntityReferenceItem.php +++ b/core/lib/Drupal/Core/Field/Plugin/Field/FieldType/EntityReferenceItem.php @@ -637,7 +637,7 @@ public static function fieldSettingsAjaxProcessElement(&$element, $main_form) { if (!empty($element['#ajax'])) { $element['#ajax'] = [ 'callback' => [get_called_class(), 'settingsAjax'], - 'wrapper' => $main_form['#id'], + 'selector' => '#' . $main_form['#id'], 'element' => $main_form['#array_parents'], ]; } diff --git a/core/lib/Drupal/Core/Field/WidgetBase.php b/core/lib/Drupal/Core/Field/WidgetBase.php index 63671576b2..3a1ff25e04 100644 --- a/core/lib/Drupal/Core/Field/WidgetBase.php +++ b/core/lib/Drupal/Core/Field/WidgetBase.php @@ -249,7 +249,7 @@ protected function formMultipleElements(FieldItemListInterface $items, array &$f '#submit' => [[get_class($this), 'addMoreSubmit']], '#ajax' => [ 'callback' => [get_class($this), 'addMoreAjax'], - 'wrapper' => $wrapper_id, + 'selector' => '#' . $wrapper_id, 'effect' => 'fade', ], ]; diff --git a/core/lib/Drupal/Core/Render/Element/RenderElement.php b/core/lib/Drupal/Core/Render/Element/RenderElement.php index 35814589b3..a3deadffbb 100644 --- a/core/lib/Drupal/Core/Render/Element/RenderElement.php +++ b/core/lib/Drupal/Core/Render/Element/RenderElement.php @@ -243,7 +243,7 @@ public static function processAjaxForm(&$element, FormStateInterface $form_state * - #ajax['url'] * - #ajax['callback'] * - #ajax['options'] - * - #ajax['wrapper'] + * - #ajax['selector'] * - #ajax['parameters'] * - #ajax['effect'] * - #ajax['accepts'] @@ -328,6 +328,13 @@ public static function preRenderAjaxForm($element) { $settings = $element['#ajax']; + // @todo Remove support for 'wrapper' and solely use '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 "selector" instead and prefix the value with either "#" for IDs or "." for classes.', E_USER_DEPRECATED); + $settings['selector'] = '#' . $settings['wrapper']; + unset($settings['wrapper']); + } + // Assign default settings. When 'url' is set to NULL, ajax.js submits the // Ajax request to the same URL as the form or link destination is for // someone with JavaScript disabled. This is generally preferred as a way to diff --git a/core/misc/ajax.es6.js b/core/misc/ajax.es6.js index a2609c02f4..549bc9c5c6 100644 --- a/core/misc/ajax.es6.js +++ b/core/misc/ajax.es6.js @@ -7,7 +7,7 @@ * then executed to make any changes that are necessary to the page. * * Drupal uses this file to enhance form elements with `#ajax['url']` and - * `#ajax['wrapper']` properties. If set, this file will automatically be + * `#ajax['selector']` properties. If set, this file will automatically be * included to provide Ajax capabilities. */ @@ -360,7 +360,7 @@ * then executed to make any changes that are necessary to the page. * * Drupal uses this file to enhance form elements with `#ajax['url']` and - * `#ajax['wrapper']` properties. If set, this file will automatically be + * `#ajax['selector']` properties. If set, this file will automatically be * included to provide Ajax capabilities. * * @constructor @@ -402,15 +402,19 @@ */ this.instanceIndex = false; - // @todo Remove this after refactoring the PHP code to: - // - Call this 'selector'. - // - Include the '#' for ID-based selectors. - // - Support non-ID-based selectors. - if (this.wrapper) { + // @todo Remove support for 'wrapper' and solely use 'selector'. + if (this.wrapper && !this.selector) { /** * @type {string} */ - this.wrapper = `#${this.wrapper}`; + this.selector = `#${this.wrapper}`; + + /** + * @deprecated Use this.selector. + * + * @type {string} + */ + this.wrapper = this.selector; } /** @@ -1085,7 +1089,7 @@ this.progress.object.stopMonitoring(); } // Undo hide. - $(this.wrapper).show(); + $(this.selector).show(); // Re-enable the element. $(this.element).prop('disabled', false); // Reattach behaviors, if they were detached in beforeSerialize(), and the @@ -1201,7 +1205,7 @@ // our presets. const $wrapper = response.selector ? $(response.selector) - : $(ajax.wrapper); + : $(ajax.selector); const method = response.method || ajax.method; const effect = ajax.getEffect(response); @@ -1255,7 +1259,7 @@ // Attach all JavaScript behaviors to the new content, if it was // successfully added to the page, this if statement allows - // `#ajax['wrapper']` to be optional. + // `#ajax['selector']` to be optional. if ($newContent.parents('html').length) { // Attach behaviors to all element nodes. $newContent.each((index, element) => { diff --git a/core/misc/ajax.js b/core/misc/ajax.js index 194c5e525a..6b12b03a6c 100644 --- a/core/misc/ajax.js +++ b/core/misc/ajax.js @@ -172,8 +172,10 @@ function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr this.instanceIndex = false; - if (this.wrapper) { - this.wrapper = '#' + this.wrapper; + if (this.wrapper && !this.selector) { + this.selector = '#' + this.wrapper; + + this.wrapper = this.selector; } this.element = element; @@ -489,7 +491,7 @@ function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr this.progress.object.stopMonitoring(); } - $(this.wrapper).show(); + $(this.selector).show(); $(this.element).prop('disabled', false); @@ -513,7 +515,7 @@ function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr Drupal.AjaxCommands = function () {}; Drupal.AjaxCommands.prototype = { insert: function insert(ajax, response) { - var $wrapper = response.selector ? $(response.selector) : $(ajax.wrapper); + var $wrapper = response.selector ? $(response.selector) : $(ajax.selector); var method = response.method || ajax.method; var effect = ajax.getEffect(response); diff --git a/core/misc/dialog/dialog.ajax.es6.js b/core/misc/dialog/dialog.ajax.es6.js index 2a017d29f8..b777d9bf2f 100644 --- a/core/misc/dialog/dialog.ajax.es6.js +++ b/core/misc/dialog/dialog.ajax.es6.js @@ -125,8 +125,8 @@ ).appendTo('body'); } // Set up the wrapper, if there isn't one. - if (!ajax.wrapper) { - ajax.wrapper = $dialog.attr('id'); + if (!ajax.selector) { + ajax.selector = '#' + $dialog.attr('id'); } // Use the ajax.js insert command to populate the dialog contents. diff --git a/core/misc/dialog/dialog.ajax.js b/core/misc/dialog/dialog.ajax.js index de1d3c9219..43f99fb2d7 100644 --- a/core/misc/dialog/dialog.ajax.js +++ b/core/misc/dialog/dialog.ajax.js @@ -72,8 +72,8 @@ $dialog = $('
').appendTo('body'); } - if (!ajax.wrapper) { - ajax.wrapper = $dialog.attr('id'); + if (!ajax.selector) { + ajax.selector = '#' + $dialog.attr('id'); } response.command = 'insert'; 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..05297ae7dc 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', + 'selector' => '#party-container', 'callback' => [$this, 'partyCallback'], ], '#default_value' => $having_a_party, diff --git a/core/modules/block/src/BlockForm.php b/core/modules/block/src/BlockForm.php index 6998a64d46..c8b1c114ab 100644 --- a/core/modules/block/src/BlockForm.php +++ b/core/modules/block/src/BlockForm.php @@ -170,7 +170,7 @@ public function form(array $form, FormStateInterface $form_state) { '#default_value' => $theme, '#ajax' => [ 'callback' => '::themeSwitch', - 'wrapper' => 'edit-block-region-wrapper', + 'selector' => '#edit-block-region-wrapper', ], ]; } diff --git a/core/modules/book/src/BookManager.php b/core/modules/book/src/BookManager.php index bfe55881af..2ca1fb0434 100644 --- a/core/modules/book/src/BookManager.php +++ b/core/modules/book/src/BookManager.php @@ -244,7 +244,7 @@ public function addFormElements(array $form, FormStateInterface $form_state, Nod '#attributes' => ['class' => ['book-title-select']], '#ajax' => [ 'callback' => 'book_form_update', - 'wrapper' => 'edit-book-plid-wrapper', + 'selector' => '#edit-book-plid-wrapper', 'effect' => 'fade', 'speed' => 'fast', ], diff --git a/core/modules/config/src/Form/ConfigSingleExportForm.php b/core/modules/config/src/Form/ConfigSingleExportForm.php index b09ca9ab94..33936a276e 100644 --- a/core/modules/config/src/Form/ConfigSingleExportForm.php +++ b/core/modules/config/src/Form/ConfigSingleExportForm.php @@ -95,7 +95,7 @@ public function buildForm(array $form, FormStateInterface $form_state, $config_t '#default_value' => $config_type, '#ajax' => [ 'callback' => '::updateConfigurationType', - 'wrapper' => 'edit-config-type-wrapper', + 'selector' => '#edit-config-type-wrapper', ], ]; $default_type = $form_state->getValue('config_type', $config_type); @@ -108,7 +108,7 @@ public function buildForm(array $form, FormStateInterface $form_state, $config_t '#suffix' => '', '#ajax' => [ 'callback' => '::updateExport', - 'wrapper' => 'edit-export-wrapper', + 'selector' => '#edit-export-wrapper', ], ]; diff --git a/core/modules/config/tests/config_test/src/ConfigTestForm.php b/core/modules/config/tests/config_test/src/ConfigTestForm.php index 163359613d..cb302fd468 100644 --- a/core/modules/config/tests/config_test/src/ConfigTestForm.php +++ b/core/modules/config/tests/config_test/src/ConfigTestForm.php @@ -73,7 +73,7 @@ public function form(array $form, FormStateInterface $form_state) { '#default_value' => $size, '#ajax' => [ 'callback' => '::updateSize', - 'wrapper' => 'size-wrapper', + 'selector' => '#size-wrapper', ], ]; $form['size_wrapper']['size_submit'] = [ diff --git a/core/modules/editor/editor.module b/core/modules/editor/editor.module index aa8d988f58..6b1076dde1 100644 --- a/core/modules/editor/editor.module +++ b/core/modules/editor/editor.module @@ -130,7 +130,7 @@ function editor_form_filter_format_form_alter(&$form, FormStateInterface $form_s '#ajax' => [ 'trigger_as' => ['name' => 'editor_configure'], 'callback' => 'editor_form_filter_admin_form_ajax', - 'wrapper' => 'editor-settings-wrapper', + 'selector' => '#editor-settings-wrapper', ], '#weight' => -10, ]; @@ -142,7 +142,7 @@ function editor_form_filter_format_form_alter(&$form, FormStateInterface $form_s '#submit' => ['editor_form_filter_admin_format_editor_configure'], '#ajax' => [ 'callback' => 'editor_form_filter_admin_form_ajax', - 'wrapper' => 'editor-settings-wrapper', + 'selector' => '#editor-settings-wrapper', ], '#weight' => -10, '#attributes' => ['class' => ['js-hide']], diff --git a/core/modules/field_layout/src/Form/FieldLayoutEntityDisplayFormTrait.php b/core/modules/field_layout/src/Form/FieldLayoutEntityDisplayFormTrait.php index 170bcd093a..42449b1303 100644 --- a/core/modules/field_layout/src/Form/FieldLayoutEntityDisplayFormTrait.php +++ b/core/modules/field_layout/src/Form/FieldLayoutEntityDisplayFormTrait.php @@ -65,7 +65,7 @@ public function form(array $form, FormStateInterface $form_state) { '#default_value' => $layout_plugin->getPluginId(), '#ajax' => [ 'callback' => '::settingsAjax', - 'wrapper' => 'field-layout-settings-wrapper', + 'selector' => '#field-layout-settings-wrapper', 'trigger_as' => ['name' => 'field_layout_change'], ], ]; @@ -77,7 +77,7 @@ public function form(array $form, FormStateInterface $form_state) { '#attributes' => ['class' => ['js-hide']], '#ajax' => [ 'callback' => '::settingsAjax', - 'wrapper' => 'field-layout-settings-wrapper', + 'selector' => '#field-layout-settings-wrapper', ], ]; diff --git a/core/modules/field_ui/src/Form/EntityDisplayFormBase.php b/core/modules/field_ui/src/Form/EntityDisplayFormBase.php index ebdbaed2c7..babb38c20f 100644 --- a/core/modules/field_ui/src/Form/EntityDisplayFormBase.php +++ b/core/modules/field_ui/src/Form/EntityDisplayFormBase.php @@ -236,7 +236,7 @@ public function form(array $form, FormStateInterface $form_state) { '#submit' => ['::multistepSubmit'], '#ajax' => [ 'callback' => '::multistepAjax', - 'wrapper' => 'field-display-overview-wrapper', + 'selector' => '#field-display-overview-wrapper', 'effect' => 'fade', // The button stays hidden, so we hide the Ajax spinner too. Ad-hoc // spinners will be added manually by the client-side script. @@ -348,7 +348,7 @@ protected function buildFieldRow(FieldDefinitionInterface $field_definition, arr '#submit' => ['::multistepSubmit'], '#ajax' => [ 'callback' => '::multistepAjax', - 'wrapper' => 'field-display-overview-wrapper', + 'selector' => '#field-display-overview-wrapper', 'effect' => 'fade', ], '#field_name' => $field_name, diff --git a/core/modules/file/src/Element/ManagedFile.php b/core/modules/file/src/Element/ManagedFile.php index b26118916e..80e9c4792a 100644 --- a/core/modules/file/src/Element/ManagedFile.php +++ b/core/modules/file/src/Element/ManagedFile.php @@ -230,7 +230,7 @@ public static function processManagedFile(&$element, FormStateInterface $form_st 'element_parents' => implode('/', $element['#array_parents']), ], ], - 'wrapper' => $ajax_wrapper_id, + 'selector' => '#' . $ajax_wrapper_id, 'effect' => 'fade', 'progress' => [ 'type' => $element['#progress_indicator'], diff --git a/core/modules/file/src/Plugin/Field/FieldWidget/FileWidget.php b/core/modules/file/src/Plugin/Field/FieldWidget/FileWidget.php index f1da5a4b5f..c46cfca851 100644 --- a/core/modules/file/src/Plugin/Field/FieldWidget/FileWidget.php +++ b/core/modules/file/src/Plugin/Field/FieldWidget/FileWidget.php @@ -426,11 +426,11 @@ public static function process($element, FormStateInterface $form_state, $form) ], ]; $field_element = NestedArray::getValue($form, $parents); - $new_wrapper = $field_element['#id'] . '-ajax-wrapper'; + $new_wrapper = '#' . $field_element['#id'] . '-ajax-wrapper'; foreach (Element::children($element) as $key) { if (isset($element[$key]['#ajax'])) { $element[$key]['#ajax']['options'] = $new_options; - $element[$key]['#ajax']['wrapper'] = $new_wrapper; + $element[$key]['#ajax']['selector'] = $new_wrapper; } } unset($element['#prefix'], $element['#suffix']); diff --git a/core/modules/layout_builder/src/Plugin/Block/FieldBlock.php b/core/modules/layout_builder/src/Plugin/Block/FieldBlock.php index 88e608f6f4..f593ebdbc7 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', + '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..a273906f85 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', + 'selector' => '#test-ajax-wrapper', 'callback' => [$this, 'ajaxCallback'], ], ]; diff --git a/core/modules/media_library/src/Form/AddFormBase.php b/core/modules/media_library/src/Form/AddFormBase.php index da783d36ab..c972a61a28 100644 --- a/core/modules/media_library/src/Form/AddFormBase.php +++ b/core/modules/media_library/src/Form/AddFormBase.php @@ -266,7 +266,7 @@ protected function buildActions(array $form, FormStateInterface $form_state) { '#value' => $this->t('Save'), '#ajax' => [ 'callback' => '::updateWidget', - 'wrapper' => 'media-library-add-form-wrapper', + 'selector' => '#media-library-add-form-wrapper', ], ], ]; diff --git a/core/modules/media_library/src/Form/FileUploadForm.php b/core/modules/media_library/src/Form/FileUploadForm.php index e89b67e7d1..29ea3e6072 100644 --- a/core/modules/media_library/src/Form/FileUploadForm.php +++ b/core/modules/media_library/src/Form/FileUploadForm.php @@ -178,7 +178,7 @@ public function processUploadElement(array $element, FormStateInterface $form_st $element['upload_button']['#submit'] = ['::uploadButtonSubmit']; $element['upload_button']['#ajax'] = [ 'callback' => '::updateFormCallback', - 'wrapper' => 'media-library-wrapper', + 'selector' => '#media-library-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 3ecf3ed78e..6fb560cc0c 100644 --- a/core/modules/media_library/src/Plugin/Field/FieldWidget/MediaLibraryWidget.php +++ b/core/modules/media_library/src/Plugin/Field/FieldWidget/MediaLibraryWidget.php @@ -337,7 +337,7 @@ public function formElement(FieldItemListInterface $items, $delta, array $elemen ], '#ajax' => [ 'callback' => [static::class, 'updateWidget'], - 'wrapper' => $wrapper_id, + 'selector' => '#' . $wrapper_id, ], '#submit' => [[static::class, 'removeItem']], // Prevent errors in other widgets from preventing removal. @@ -425,7 +425,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, + 'selector' => '#' . $wrapper_id, ], '#attributes' => [ 'data-media-library-widget-update' => $field_name . $id_suffix, diff --git a/core/modules/responsive_image/src/ResponsiveImageStyleForm.php b/core/modules/responsive_image/src/ResponsiveImageStyleForm.php index 86328255e7..d1c085c002 100644 --- a/core/modules/responsive_image/src/ResponsiveImageStyleForm.php +++ b/core/modules/responsive_image/src/ResponsiveImageStyleForm.php @@ -100,7 +100,7 @@ public function form(array $form, FormStateInterface $form_state) { '#description' => $description, '#ajax' => [ 'callback' => '::breakpointMappingFormAjax', - 'wrapper' => 'responsive-image-style-breakpoints-wrapper', + 'selector' => '#responsive-image-style-breakpoints-wrapper', ], ]; diff --git a/core/modules/simpletest/src/WebTestBase.php b/core/modules/simpletest/src/WebTestBase.php index 54d64e7856..46cb7d65f7 100644 --- a/core/modules/simpletest/src/WebTestBase.php +++ b/core/modules/simpletest/src/WebTestBase.php @@ -1247,10 +1247,16 @@ protected function drupalProcessAjaxResponse($content, array $ajax_response, arr case 'insert': $wrapperNode = NULL; - // When a command doesn't specify a selector, use the - // #ajax['wrapper'] which is always an HTML ID. + // When a command doesn't specify a selector, use #ajax['selector']. if (!isset($command['selector'])) { - $wrapperNode = $xpath->query('//*[@id="' . $ajax_settings['wrapper'] . '"]')->item(0); + $selector_type = substr($ajax_settings['selector'], 0, 1); + $selector = substr($ajax_settings['selector'], 1); + if ($selector_type === '#') { + $wrapperNode = $xpath->query('//*[@id="' . $selector . '"]')->item(0); + } + else { + $wrapperNode = $xpath->query('//*[contains(@class, ' . $selector . ')]')->item(0); + } } // @todo Ajax commands can target any jQuery selector, but these are // hard to fully emulate with XPath. For now, just handle 'head' 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..5aad1ea3bd 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', + 'selector' => '#ajax_datetime_value', ], ]; diff --git a/core/modules/system/tests/modules/ajax_forms_test/src/Form/AjaxFormsTestLazyLoadForm.php b/core/modules/system/tests/modules/ajax_forms_test/src/Form/AjaxFormsTestLazyLoadForm.php index 7dddf877c4..0dcad22217 100644 --- a/core/modules/system/tests/modules/ajax_forms_test/src/Form/AjaxFormsTestLazyLoadForm.php +++ b/core/modules/system/tests/modules/ajax_forms_test/src/Form/AjaxFormsTestLazyLoadForm.php @@ -37,7 +37,7 @@ public function buildForm(array $form, FormStateInterface $form_state) { '#type' => 'submit', '#value' => $this->t('Submit'), '#ajax' => [ - 'wrapper' => 'ajax-forms-test-lazy-load-ajax-wrapper', + 'selector' => '#ajax-forms-test-lazy-load-ajax-wrapper', 'callback' => 'ajax_forms_test_lazy_load_form_ajax', ], '#prefix' => '', 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 35e0b08e20..d614ed415a 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 @@ -86,7 +86,7 @@ public function buildForm(array $form, FormStateInterface $form_state) { '#title' => $this->t('AJAX checkbox in a group'), '#ajax' => [ 'callback' => [$object, 'checkboxGroupCallback'], - 'wrapper' => 'checkbox-wrapper', + 'selector' => '#checkbox-wrapper', ], ], 'nested_group' => [ @@ -100,7 +100,7 @@ public function buildForm(array $form, FormStateInterface $form_state) { '#title' => $this->t('AJAX checkbox in a nested group'), '#ajax' => [ 'callback' => [$object, 'checkboxGroupCallback'], - 'wrapper' => 'checkbox-wrapper', + 'selector' => '#checkbox-wrapper', ], ], ]; diff --git a/core/modules/system/tests/modules/ajax_forms_test/src/Form/AjaxFormsTestValidationForm.php b/core/modules/system/tests/modules/ajax_forms_test/src/Form/AjaxFormsTestValidationForm.php index ef6ddaf736..43832624e0 100644 --- a/core/modules/system/tests/modules/ajax_forms_test/src/Form/AjaxFormsTestValidationForm.php +++ b/core/modules/system/tests/modules/ajax_forms_test/src/Form/AjaxFormsTestValidationForm.php @@ -30,7 +30,7 @@ public function buildForm(array $form, FormStateInterface $form_state) { '#default_value' => $form_state->getValue('drivertext', ''), '#ajax' => [ 'callback' => 'ajax_forms_test_validation_form_callback', - 'wrapper' => 'message_area', + 'selector' => '#message_area', 'method' => 'replace', ], '#suffix' => '', @@ -43,7 +43,7 @@ public function buildForm(array $form, FormStateInterface $form_state) { '#default_value' => $form_state->getValue('drivernumber', ''), '#ajax' => [ 'callback' => 'ajax_forms_test_validation_number_form_callback', - 'wrapper' => 'message_area_number', + 'selector' => '#message_area_number', 'method' => 'replace', ], '#suffix' => '', diff --git a/core/modules/system/tests/modules/ajax_forms_test/src/Plugin/Block/AjaxFormBlock.php b/core/modules/system/tests/modules/ajax_forms_test/src/Plugin/Block/AjaxFormBlock.php index 65e1372d99..aeec542f84 100644 --- a/core/modules/system/tests/modules/ajax_forms_test/src/Plugin/Block/AjaxFormBlock.php +++ b/core/modules/system/tests/modules/ajax_forms_test/src/Plugin/Block/AjaxFormBlock.php @@ -96,7 +96,7 @@ public function buildForm(array $form, FormStateInterface $form_state) { ], '#ajax' => [ 'callback' => '::updateOptions', - 'wrapper' => 'edit-test1-wrapper', + 'selector' => '#edit-test1-wrapper', ], '#prefix' => '