From d5a2030736e84ced0c93c515bc5f12b9774e831c Mon Sep 17 00:00:00 2001 From: Michael Caldwell <21485-justcaldwell@users.noreply.drupalcode.org> Date: Tue, 7 Feb 2023 07:38:33 +0000 Subject: [PATCH] Issue #3274079 by justcaldwell: Remove Admin Toolbar from preview --- css/live_preview.css | 7 ------- split_preview.module | 13 +++++++++++++ 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/css/live_preview.css b/css/live_preview.css index 40f2fa9..3e94a79 100644 --- a/css/live_preview.css +++ b/css/live_preview.css @@ -17,9 +17,6 @@ right: 0; z-index: 1000; height: 100%; - display: -webkit-box; - display: -ms-flexbox; - display: flex; width: 100%; } @@ -28,12 +25,8 @@ } .live-preview__actions { - position: absolute; - top: 0; - right: 0; padding: 2px 0; background: black; - width: 100%; text-align: right; transition: all 0.5s; } diff --git a/split_preview.module b/split_preview.module index da594ef..8a971e0 100644 --- a/split_preview.module +++ b/split_preview.module @@ -61,6 +61,18 @@ function split_preview_form_alter(array &$form, FormStateInterface $form_state, } } +/** + * Implements hook_preprocess_HOOK(). + */ +function split_preview_preprocess_html(&$variables) { + $split_preview = \Drupal::request()->query->get('split_preview'); + if ($split_preview === 'true') { + if (isset($variables['page_top']['toolbar'])) { + unset($variables['page_top']['toolbar']); + } + } +} + /** * Ajax submit ajax handler form. * @@ -101,6 +113,7 @@ function _submit_ajax_form(array &$form, FormStateInterface $form_state) { $route_parameters = [ 'node_preview' => $uuid, 'view_mode_id' => 'full', + 'split_preview' => 'true', ]; // Setting preview node url. -- GitLab