diff --git a/core/lib/Drupal/Core/EventSubscriber/MainContentViewSubscriber.php b/core/lib/Drupal/Core/EventSubscriber/MainContentViewSubscriber.php index 0dd8e2f..cbdce65 100644 --- a/core/lib/Drupal/Core/EventSubscriber/MainContentViewSubscriber.php +++ b/core/lib/Drupal/Core/EventSubscriber/MainContentViewSubscriber.php @@ -50,6 +50,11 @@ class MainContentViewSubscriber implements EventSubscriberInterface { */ protected $mainContentRenderers; + /** + * Url query attribute to indicate the wrapper used to render a request. + * + * This controls wrapping the HTML content for example in a modal dialog. + */ const WRAPPER_ENVELOPE = '_wrapper_format'; /** @@ -80,7 +85,7 @@ public function onViewRenderArray(GetResponseForControllerResultEvent $event) { // Render the controller result into a response if it's a render array. if (is_array($result)) { - // We default to requestFormat() because content negotiation uses this as + // We default to getRequestFormat() because content negotiation uses this as // its fallback method for displaying a 406 when we fail to match a route // based on format. // @todo this logic should be replaced with a more clear opt in to avoid diff --git a/core/misc/ajax.js b/core/misc/ajax.js index 0ccd579..1e26c9d 100644 --- a/core/misc/ajax.js +++ b/core/misc/ajax.js @@ -17,6 +17,13 @@ Drupal.ajax = Drupal.ajax || {}; /** + * Url query attribute to indicate the wrapper used to render a request. + * + * This controls wrapping the HTML content for example in a modal dialog. + */ + Drupal.ajax.WRAPPER_ENVELOPE = '_wrapper_format'; + + /** * Attaches the Ajax behavior to each Ajax form element. */ Drupal.behaviors.AJAX = { @@ -272,7 +279,7 @@ else { ajax.options.url += '&'; } - ajax.options.url += '_wrapper_format=drupal_' + element_settings.dialogType; + ajax.options.url += Drupal.ajax.WRAPPER_ENVELOPE + '=drupal_' + element_settings.dialogType; } // Bind the ajaxSubmit function to the element event. diff --git a/core/modules/ckeditor/js/ckeditor.js b/core/modules/ckeditor/js/ckeditor.js index 7f9dbf0..525f8d2 100644 --- a/core/modules/ckeditor/js/ckeditor.js +++ b/core/modules/ckeditor/js/ckeditor.js @@ -160,8 +160,8 @@ // a Drupal.ajax instance to load the dialog and trigger it. var $content = $('
'); $content.appendTo($target); - new Drupal.ajax('ckeditor-dialog', $content.find('a').get(0), { - _wrapper_format: 'modal', + + var options = { dialog: dialogSettings, selector: '.ckeditor-dialog-loading-link', url: url, @@ -170,7 +170,9 @@ submit: { editor_object: existingValues } - }); + }; + options[Drupal.ajax.WRAPPER_ENVELOPE] = 'modal'; + new Drupal.ajax('ckeditor-dialog', $content.find('a').get(0), options); $content.find('a') .on('click', function () { return false; }) .trigger('ckeditor-internal.ckeditor');