diff --git a/core/core.libraries.yml b/core/core.libraries.yml index ccc5761181..01becf613e 100644 --- a/core/core.libraries.yml +++ b/core/core.libraries.yml @@ -903,3 +903,30 @@ underscore: gpl-compatible: true js: assets/vendor/underscore/underscore-min.js: { weight: -20, minified: true } + +drupal.dialog.off_canvas: + version: VERSION + js: + misc/dialog/off-canvas.js: {} + css: + base: + misc/dialog/css/off-canvas.reset.css: {} + misc/dialog/css/off-canvas.base.css: {} + misc/dialog/css/off-canvas.css: {} + misc/dialog/css/off-canvas.theme.css: { group: 200 } + component: + misc/dialog/css/off-canvas.motion.css: {} + misc/dialog/css/off-canvas.button.css: {} + misc/dialog/css/off-canvas.form.css: {} + misc/dialog/css/off-canvas.table.css: {} + misc/dialog/css/off-canvas.details.css: {} + misc/dialog/css/off-canvas.tabledrag.css: {} + misc/dialog/css/off-canvas.dropbutton.css: {} + + dependencies: + - core/jquery + - core/drupal + - core/drupal.ajax + - core/drupal.announce + - core/drupal.dialog + - core/drupal.dialog.ajax diff --git a/core/core.services.yml b/core/core.services.yml index 76088786cd..98996a6101 100644 --- a/core/core.services.yml +++ b/core/core.services.yml @@ -1065,6 +1065,11 @@ services: arguments: ['@title_resolver'] tags: - { name: render.main_content_renderer, format: drupal_dialog } + main_content_renderer.off_canvas: + class: Drupal\Core\Render\MainContent\OffCanvasRenderer + arguments: ['@title_resolver', '@renderer'] + tags: + - { name: render.main_content_renderer, format: drupal_dialog.off_canvas } main_content_renderer.modal: class: Drupal\Core\Render\MainContent\ModalRenderer arguments: ['@title_resolver'] diff --git a/core/modules/outside_in/src/Ajax/OpenOffCanvasDialogCommand.php b/core/lib/Drupal/Core/Ajax/OpenOffCanvasDialogCommand.php similarity index 94% rename from core/modules/outside_in/src/Ajax/OpenOffCanvasDialogCommand.php rename to core/lib/Drupal/Core/Ajax/OpenOffCanvasDialogCommand.php index 2371483ed5..da6a26e35a 100644 --- a/core/modules/outside_in/src/Ajax/OpenOffCanvasDialogCommand.php +++ b/core/lib/Drupal/Core/Ajax/OpenOffCanvasDialogCommand.php @@ -1,8 +1,6 @@ dialogOptions['buttons'] = []; + if (empty($dialog_options['dialogClass'])) { + $this->dialogOptions['dialogClass'] = 'ui-dialog-off-canvas'; + } // If no width option is provided then use the default width to avoid the // dialog staying at the width of the previous instance when opened // more than once, with different widths, on a single page. diff --git a/core/modules/outside_in/src/Render/MainContent/OffCanvasRenderer.php b/core/lib/Drupal/Core/Render/MainContent/OffCanvasRenderer.php similarity index 89% rename from core/modules/outside_in/src/Render/MainContent/OffCanvasRenderer.php rename to core/lib/Drupal/Core/Render/MainContent/OffCanvasRenderer.php index 3286ed9f4b..b3e4a4478c 100644 --- a/core/modules/outside_in/src/Render/MainContent/OffCanvasRenderer.php +++ b/core/lib/Drupal/Core/Render/MainContent/OffCanvasRenderer.php @@ -1,13 +1,12 @@ renderer->renderRoot($main_content); // Attach the library necessary for using the OpenOffCanvasDialogCommand and // set the attachments for this Ajax response. - $main_content['#attached']['library'][] = 'outside_in/drupal.off_canvas'; + $main_content['#attached']['library'][] = 'core/drupal.dialog.off_canvas'; $response->setAttachments($main_content['#attached']); // If the main content doesn't provide a title, use the title resolver. diff --git a/core/modules/outside_in/js/off-canvas.es6.js b/core/misc/dialog/off-canvas.es6.js similarity index 100% rename from core/modules/outside_in/js/off-canvas.es6.js rename to core/misc/dialog/off-canvas.es6.js diff --git a/core/modules/outside_in/js/off-canvas.js b/core/misc/dialog/off-canvas.js similarity index 100% rename from core/modules/outside_in/js/off-canvas.js rename to core/misc/dialog/off-canvas.js diff --git a/core/modules/outside_in/js/outside_in.es6.js b/core/modules/outside_in/js/outside_in.es6.js index 76bb872749..85607a8795 100644 --- a/core/modules/outside_in/js/outside_in.es6.js +++ b/core/modules/outside_in/js/outside_in.es6.js @@ -235,7 +235,6 @@ const $activeElement = $(`#${settings.outsideInActiveEditableId}`); if ($activeElement.length) { $activeElement.addClass('outside-in-active-editable'); - settings.dialogClass += ' ui-dialog-outside-in'; } } }, diff --git a/core/modules/outside_in/js/outside_in.js b/core/modules/outside_in/js/outside_in.js index 95cf90e225..b97d959918 100644 --- a/core/modules/outside_in/js/outside_in.js +++ b/core/modules/outside_in/js/outside_in.js @@ -144,7 +144,6 @@ var $activeElement = $('#' + settings.outsideInActiveEditableId); if ($activeElement.length) { $activeElement.addClass('outside-in-active-editable'); - settings.dialogClass += ' ui-dialog-outside-in'; } } }, diff --git a/core/modules/outside_in/outside_in.libraries.yml b/core/modules/outside_in/outside_in.libraries.yml index 5c388b82f1..64e1eddd19 100644 --- a/core/modules/outside_in/outside_in.libraries.yml +++ b/core/modules/outside_in/outside_in.libraries.yml @@ -6,10 +6,7 @@ drupal.outside_in: component: css/outside_in.module.css: {} css/outside_in.motion.css: {} - css/outside_in.form.css: {} - css/outside_in.table.css: {} - css/outside_in.details.css: {} - css/outside_in.tabledrag.css: {} + css/outside_in.toolbar.css: {} theme: # @todo Set the group higher than CSS_AGGREGATE_THEME so that it overrides # both jQuery UI and Classy's dialog.css, remove in @@ -20,14 +17,3 @@ drupal.outside_in: - core/drupal - core/jquery.once - core/drupal.ajax -drupal.off_canvas: - version: VERSION - js: - js/off-canvas.js: {} - dependencies: - - core/jquery - - core/drupal - - core/drupal.ajax - - core/drupal.announce - - core/drupal.dialog - - core/drupal.dialog.ajax diff --git a/core/modules/outside_in/outside_in.module b/core/modules/outside_in/outside_in.module index 69517b9919..b465208ba7 100644 --- a/core/modules/outside_in/outside_in.module +++ b/core/modules/outside_in/outside_in.module @@ -50,7 +50,7 @@ function outside_in_contextual_links_view_alter(&$element, $items) { $element['#links']['outside-inblock-configure']['title'] = t('Quick edit settings'); } - $element['#attached']['library'][] = 'outside_in/drupal.off_canvas'; + $element['#attached']['library'][] = 'core/drupal.dialog.off_canvas'; } } @@ -67,26 +67,6 @@ function outside_in_block_view_alter(array &$build) { } /** - * Implements hook_element_info_alter(). - */ -function outside_in_element_info_alter(&$type) { - if (isset($type['page'])) { - $type['page']['#theme_wrappers']['outside_in_page_wrapper'] = ['#weight' => -1000]; - } -} - -/** - * Implements hook_theme(). - */ -function outside_in_theme() { - return [ - 'outside_in_page_wrapper' => [ - 'variables' => ['children' => NULL], - ], - ]; -} - -/** * Implements hook_entity_type_build(). */ function outside_in_entity_type_build(array &$entity_types) { diff --git a/core/modules/outside_in/outside_in.services.yml b/core/modules/outside_in/outside_in.services.yml deleted file mode 100644 index ce8214697a..0000000000 --- a/core/modules/outside_in/outside_in.services.yml +++ /dev/null @@ -1,6 +0,0 @@ -services: - main_content_renderer.off_canvas: - class: Drupal\outside_in\Render\MainContent\OffCanvasRenderer - arguments: ['@title_resolver', '@renderer'] - tags: - - { name: render.main_content_renderer, format: drupal_dialog.off_canvas } diff --git a/core/modules/outside_in/tests/src/FunctionalJavascript/OutsideInBlockFormTest.php b/core/modules/outside_in/tests/src/FunctionalJavascript/OutsideInBlockFormTest.php index 04fc230f5e..2dd3d69c57 100644 --- a/core/modules/outside_in/tests/src/FunctionalJavascript/OutsideInBlockFormTest.php +++ b/core/modules/outside_in/tests/src/FunctionalJavascript/OutsideInBlockFormTest.php @@ -5,6 +5,7 @@ use Drupal\block\Entity\Block; use Drupal\block_content\Entity\BlockContent; use Drupal\block_content\Entity\BlockContentType; +use Drupal\Tests\system\FunctionalJavascript\OffCanvasTestBase; use Drupal\user\Entity\Role; /** @@ -12,7 +13,7 @@ * * @group outside_in */ -class OutsideInBlockFormTest extends OutsideInJavascriptTestBase { +class OutsideInBlockFormTest extends OffCanvasTestBase { const TOOLBAR_EDIT_LINK_SELECTOR = '#toolbar-bar div.contextual-toolbar-tab button'; diff --git a/core/modules/outside_in/src/Tests/Ajax/OffCanvasDialogTest.php b/core/modules/system/src/Tests/Ajax/OffCanvasDialogTest.php similarity index 84% rename from core/modules/outside_in/src/Tests/Ajax/OffCanvasDialogTest.php rename to core/modules/system/src/Tests/Ajax/OffCanvasDialogTest.php index edf055b577..6d7ddbb9d4 100644 --- a/core/modules/outside_in/src/Tests/Ajax/OffCanvasDialogTest.php +++ b/core/modules/system/src/Tests/Ajax/OffCanvasDialogTest.php @@ -1,30 +1,22 @@ drupalLogin($this->drupalCreateUser(['administer contact forms'])); // Ensure the elements render without notices or exceptions. $this->drupalGet('ajax-test/dialog'); @@ -46,6 +38,7 @@ public function testDialog() { 'draggable' => FALSE, 'drupalAutoButtons' => FALSE, 'buttons' => [], + 'dialogClass' => 'ui-dialog-off-canvas', 'width' => 300, ], 'effect' => 'fade', diff --git a/core/modules/system/system.module b/core/modules/system/system.module index a1a6b715a3..6f6e55e93c 100644 --- a/core/modules/system/system.module +++ b/core/modules/system/system.module @@ -268,6 +268,9 @@ function system_theme() { ], 'template' => 'entity-add-list', ], + 'off_canvas_page_wrapper' => [ + 'variables' => ['children' => NULL], + ], ]); } @@ -1489,3 +1492,13 @@ function system_query_entity_reference_alter(AlterableInterface $query) { $handler = $query->getMetadata('entity_reference_selection_handler'); $handler->entityQueryAlter($query); } + + +/** + * Implements hook_element_info_alter(). + */ +function system_element_info_alter(&$type) { + if (isset($type['page'])) { + $type['page']['#theme_wrappers']['off_canvas_page_wrapper'] = ['#weight' => -1000]; + } +} diff --git a/core/modules/outside_in/templates/outside-in-page-wrapper.html.twig b/core/modules/system/templates/off-canvas-page-wrapper.html.twig similarity index 100% rename from core/modules/outside_in/templates/outside-in-page-wrapper.html.twig rename to core/modules/system/templates/off-canvas-page-wrapper.html.twig diff --git a/core/modules/outside_in/tests/modules/off_canvas_test/off_canvas_test.info.yml b/core/modules/system/tests/modules/off_canvas_test/off_canvas_test.info.yml similarity index 76% rename from core/modules/outside_in/tests/modules/off_canvas_test/off_canvas_test.info.yml rename to core/modules/system/tests/modules/off_canvas_test/off_canvas_test.info.yml index 8c6cc80242..9680b1842d 100644 --- a/core/modules/outside_in/tests/modules/off_canvas_test/off_canvas_test.info.yml +++ b/core/modules/system/tests/modules/off_canvas_test/off_canvas_test.info.yml @@ -4,6 +4,3 @@ description: 'Provides off-canvas test links.' package: Testing version: VERSION core: 8.x -dependencies: - - block - - outside_in diff --git a/core/modules/outside_in/tests/modules/off_canvas_test/off_canvas_test.routing.yml b/core/modules/system/tests/modules/off_canvas_test/off_canvas_test.routing.yml similarity index 100% rename from core/modules/outside_in/tests/modules/off_canvas_test/off_canvas_test.routing.yml rename to core/modules/system/tests/modules/off_canvas_test/off_canvas_test.routing.yml diff --git a/core/modules/outside_in/tests/modules/off_canvas_test/src/Controller/TestController.php b/core/modules/system/tests/modules/off_canvas_test/src/Controller/TestController.php similarity index 94% rename from core/modules/outside_in/tests/modules/off_canvas_test/src/Controller/TestController.php rename to core/modules/system/tests/modules/off_canvas_test/src/Controller/TestController.php index 6164b06fc2..ea7875a030 100644 --- a/core/modules/outside_in/tests/modules/off_canvas_test/src/Controller/TestController.php +++ b/core/modules/system/tests/modules/off_canvas_test/src/Controller/TestController.php @@ -55,7 +55,7 @@ public function linksDisplay() { ], '#attached' => [ 'library' => [ - 'outside_in/drupal.outside_in', + 'core/drupal.dialog.off_canvas', ], ], ], @@ -73,7 +73,7 @@ public function linksDisplay() { ], '#attached' => [ 'library' => [ - 'outside_in/drupal.outside_in', + 'core/drupal.dialog.off_canvas', ], ], ], @@ -88,7 +88,7 @@ public function linksDisplay() { ], '#attached' => [ 'library' => [ - 'outside_in/drupal.outside_in', + 'core/drupal.dialog.off_canvas', ], ], ], @@ -131,7 +131,7 @@ public function otherDialogLinks() { ], '#attached' => [ 'library' => [ - 'outside_in/drupal.outside_in', + 'core/drupal.dialog.off_canvas', ], ], ]; diff --git a/core/modules/outside_in/tests/src/FunctionalJavascript/OffCanvasTest.php b/core/modules/system/tests/src/FunctionalJavascript/OffCanvasTest.php similarity index 97% rename from core/modules/outside_in/tests/src/FunctionalJavascript/OffCanvasTest.php rename to core/modules/system/tests/src/FunctionalJavascript/OffCanvasTest.php index 2f64d9fe2c..117b8d2da3 100644 --- a/core/modules/outside_in/tests/src/FunctionalJavascript/OffCanvasTest.php +++ b/core/modules/system/tests/src/FunctionalJavascript/OffCanvasTest.php @@ -1,13 +1,13 @@ FALSE, 'drupalAutoButtons' => FALSE, 'buttons' => [], + 'dialogClass' => 'ui-dialog-off-canvas', 'width' => 300, ], 'effect' => 'fade',