diff --git a/composer.json b/composer.json index b69e3cca7e7177a45461bae1e608c87437daa64e..51f33148b2722aa265b45bd5f0e07b9c8cff3661 100644 --- a/composer.json +++ b/composer.json @@ -20,6 +20,6 @@ "source": "https://git.drupalcode.org/project/layout_builder_iframe_modal" }, "require": { - "drupal/core": "^8.8.0 || ^9.0 || ^10" + "drupal/core": "^10.1.3 || ^11" } } diff --git a/config/schema/layout_builder_iframe_modal.schema.yml b/config/schema/layout_builder_iframe_modal.schema.yml index a1da4deab9c63688b917333045f4ccb3af89ac2f..77543fb54c34cacd6db16a86455f23fd1abe4ba9 100644 --- a/config/schema/layout_builder_iframe_modal.schema.yml +++ b/config/schema/layout_builder_iframe_modal.schema.yml @@ -8,3 +8,9 @@ layout_builder_iframe_modal.settings: sequence: type: string label: 'Route' + custom_routes: + type: sequence + label: 'Custom Iframe routes' + sequence: + type: string + label: 'Route' diff --git a/css/iframe.css b/css/iframe.css index f81935c31991ceb1728aebca6b4a1fe6d9ec1560..86836c1cae7251051553a63b6ffb4d0bdd3be64f 100644 --- a/css/iframe.css +++ b/css/iframe.css @@ -13,3 +13,7 @@ width: 100%; height: 100%; } + +.ui-dialog--lbim { + overflow: auto; +} \ No newline at end of file diff --git a/layout_builder_iframe_modal.module b/layout_builder_iframe_modal.module index de3f4abcb857b835567aa7a9f9c7a286006dcda5..837a8e750cea2e0e5b94630c3ebcfc4fb66f60a3 100644 --- a/layout_builder_iframe_modal.module +++ b/layout_builder_iframe_modal.module @@ -37,6 +37,7 @@ function layout_builder_iframe_modal_preprocess_html(&$variables) { unset($variables['page']['header']); unset($variables['page']['pre_content']); unset($variables['page']['breadcrumb']); + unset($variables['page']['footer']); unset($variables['page']['#title']); } } diff --git a/src/Controller/RebuildController.php b/src/Controller/RebuildController.php index c6e72d13d0bcad73da4337ad5449b77e36e1f72a..ef5f6a9192f241ce06ab4254af30364087d50761 100644 --- a/src/Controller/RebuildController.php +++ b/src/Controller/RebuildController.php @@ -65,6 +65,8 @@ class RebuildController implements ContainerInjectionInterface { $response->addCommand(new CloseDialogCommand('#drupal-off-canvas')); // Close settings tray (D10+). $response->addCommand(new CloseDialogCommand('#drupal-off-canvas-wrapper')); + // Close Layout Builder Browser modal, if available. + $response->addCommand(new CloseDialogCommand('#layout-builder-modal')); $response->addCommand(new ScrollToBlockCommand()); return $response; } diff --git a/src/Render/MainContent/IframeRenderer.php b/src/Render/MainContent/IframeRenderer.php index 1612b5c3796a2a2a6dd8b4a02b26e04436e34b50..eeffc4b7eea9d7c9e0737705847e96353c70829f 100644 --- a/src/Render/MainContent/IframeRenderer.php +++ b/src/Render/MainContent/IframeRenderer.php @@ -6,6 +6,7 @@ namespace Drupal\layout_builder_iframe_modal\Render\MainContent; use Drupal\Component\Utility\DeprecationHelper; use Drupal\Core\Ajax\AjaxResponse; +use Drupal\Core\EventSubscriber\MainContentViewSubscriber; use Drupal\layout_builder_iframe_modal\Ajax\OpenIframeCommand; use Drupal\Core\Routing\RouteMatchInterface; use Symfony\Component\HttpFoundation\Request; @@ -32,10 +33,16 @@ class IframeRenderer extends DialogRenderer { // Build the iframe source link. $iframe_src = Url::createFromRequest($request); - // Set the destination query parameter to our custom redirect route. - $iframe_src->setOption('query', [ - 'destination' => Url::fromRoute('layout_builder_iframe_modal.redirect')->toString(TRUE)->getGeneratedUrl(), - ]); + // Fetch the existing query parameters. + $query_params = $request->query->all(); + + // Remove the AJAX wrapper format request query parameter. + unset($query_params[MainContentViewSubscriber::WRAPPER_FORMAT]); + + // Add the destination query parameter to our custom redirect route. + $query_params['destination'] = Url::fromRoute('layout_builder_iframe_modal.redirect') + ->toString(TRUE)->getGeneratedUrl(); + $iframe_src->setOption('query', $query_params); $iframe_attributes = new Attribute([ 'src' => $iframe_src->toString(),