diff --git a/core/composer.json b/core/composer.json index 503704c..3ff4690 100644 --- a/core/composer.json +++ b/core/composer.json @@ -107,7 +107,6 @@ "drupal/image": "self.version", "drupal/inline_form_errors": "self.version", "drupal/language": "self.version", - "drupal/layout_discovery": "self.version", "drupal/link": "self.version", "drupal/locale": "self.version", "drupal/minimal": "self.version", diff --git a/core/core.services.yml b/core/core.services.yml index 40c6a8a..bdfd347 100644 --- a/core/core.services.yml +++ b/core/core.services.yml @@ -643,6 +643,9 @@ services: plugin.manager.display_variant: class: Drupal\Core\Display\VariantManager parent: default_plugin_manager + plugin.manager.core.layout: + class: Drupal\Core\Layout\LayoutPluginManager + arguments: ['@container.namespaces', '@cache.discovery', '@module_handler', '@theme_handler'] plugin.manager.queue_worker: class: Drupal\Core\Queue\QueueWorkerManager parent: default_plugin_manager diff --git a/core/lib/Drupal/Core/Layout/Annotation/Layout.php b/core/lib/Drupal/Core/Layout/Annotation/Layout.php index 1cb5ff0..4f30834 100644 --- a/core/lib/Drupal/Core/Layout/Annotation/Layout.php +++ b/core/lib/Drupal/Core/Layout/Annotation/Layout.php @@ -72,9 +72,9 @@ class Layout extends Plugin { /** * The template file to render this layout (relative to the 'path' given). * - * If specified, then the layout_discovery module will register the template - * with hook_theme() and the module or theme registering this layout does not - * need to do it. + * If specified, then the system module will register the template with + * hook_theme() and the module or theme registering this layout does not need + * to do it. * * @var string optional * diff --git a/core/modules/field_layout/field_layout.info.yml b/core/modules/field_layout/field_layout.info.yml index 237f18d..62f225a 100644 --- a/core/modules/field_layout/field_layout.info.yml +++ b/core/modules/field_layout/field_layout.info.yml @@ -4,5 +4,3 @@ description: 'Adds layout capabilities to the Field UI.' package: Core (Experimental) version: VERSION core: 8.x -dependencies: - - layout_discovery diff --git a/core/modules/field_layout/tests/src/Kernel/FieldLayoutEntityDisplayTest.php b/core/modules/field_layout/tests/src/Kernel/FieldLayoutEntityDisplayTest.php index 3ca5e59..eddd54a 100644 --- a/core/modules/field_layout/tests/src/Kernel/FieldLayoutEntityDisplayTest.php +++ b/core/modules/field_layout/tests/src/Kernel/FieldLayoutEntityDisplayTest.php @@ -14,7 +14,7 @@ class FieldLayoutEntityDisplayTest extends KernelTestBase { /** * {@inheritdoc} */ - protected static $modules = ['layout_discovery', 'field_layout', 'entity_test', 'field_layout_test', 'system']; + protected static $modules = ['field_layout', 'entity_test', 'field_layout_test', 'system']; /** * @covers ::preSave @@ -68,7 +68,7 @@ public function testPreSave() { $expected['dependencies']['module'] = [ 'entity_test', 'field_layout', - 'layout_discovery', + 'system', ]; // A third party setting is added by the entity_test module. $expected['third_party_settings']['entity_test'] = ['foo' => 'bar']; diff --git a/core/modules/layout_discovery/layout_discovery.info.yml b/core/modules/layout_discovery/layout_discovery.info.yml deleted file mode 100644 index a9a4139..0000000 --- a/core/modules/layout_discovery/layout_discovery.info.yml +++ /dev/null @@ -1,6 +0,0 @@ -name: 'Layout Discovery' -type: module -description: 'Provides a way for modules or themes to register layouts.' -package: Core (Experimental) -version: VERSION -core: 8.x diff --git a/core/modules/layout_discovery/layout_discovery.install b/core/modules/layout_discovery/layout_discovery.install deleted file mode 100644 index e6c99e0..0000000 --- a/core/modules/layout_discovery/layout_discovery.install +++ /dev/null @@ -1,22 +0,0 @@ -moduleExists('layout_plugin')) { - $requirements['layout_discovery'] = [ - 'description' => t('Layout Discovery cannot be installed because the Layout Plugin module is installed and incompatible.'), - 'severity' => REQUIREMENT_ERROR, - ]; - } - } - return $requirements; -} diff --git a/core/modules/layout_discovery/layout_discovery.libraries.yml b/core/modules/layout_discovery/layout_discovery.libraries.yml deleted file mode 100644 index aff70e0..0000000 --- a/core/modules/layout_discovery/layout_discovery.libraries.yml +++ /dev/null @@ -1,25 +0,0 @@ -onecol: - version: VERSION - css: - theme: - layouts/onecol/onecol.css: {} -twocol_bricks: - version: VERSION - css: - theme: - layouts/twocol_bricks/twocol_bricks.css: {} -twocol: - version: VERSION - css: - theme: - layouts/twocol/twocol.css: {} -threecol_25_50_25: - version: VERSION - css: - theme: - layouts/threecol_25_50_25/threecol_25_50_25.css: {} -threecol_33_34_33: - version: VERSION - css: - theme: - layouts/threecol_33_34_33/threecol_33_34_33.css: {} diff --git a/core/modules/layout_discovery/layout_discovery.module b/core/modules/layout_discovery/layout_discovery.module deleted file mode 100644 index 3cffee9..0000000 --- a/core/modules/layout_discovery/layout_discovery.module +++ /dev/null @@ -1,39 +0,0 @@ -' . t('About') . ''; - $output .= '

' . t('Layout Discovery allows modules or themes to register layouts, and for other modules to list the available layouts and render them.') . '

'; - $output .= '

' . t('For more information, see the online documentation for the Layout Discovery module.', [':layout-discovery-documentation' => 'https://www.drupal.org/node/2619128']) . '

'; - return $output; - } -} - -/** - * Implements hook_theme(). - */ -function layout_discovery_theme() { - return \Drupal::service('plugin.manager.core.layout')->getThemeImplementations(); -} - -/** - * Prepares variables for layout templates. - * - * @param array &$variables - * An associative array containing: - * - content: An associative array containing the properties of the element. - * Properties used: #settings, #layout. - */ -function template_preprocess_layout(&$variables) { - $variables['settings'] = isset($variables['content']['#settings']) ? $variables['content']['#settings'] : []; - $variables['layout'] = isset($variables['content']['#layout']) ? $variables['content']['#layout'] : []; -} diff --git a/core/modules/layout_discovery/layout_discovery.services.yml b/core/modules/layout_discovery/layout_discovery.services.yml deleted file mode 100644 index 1e24db4..0000000 --- a/core/modules/layout_discovery/layout_discovery.services.yml +++ /dev/null @@ -1,4 +0,0 @@ -services: - plugin.manager.core.layout: - class: Drupal\Core\Layout\LayoutPluginManager - arguments: ['@container.namespaces', '@cache.discovery', '@module_handler', '@theme_handler'] diff --git a/core/modules/layout_discovery/layouts/onecol/layout--onecol.html.twig b/core/modules/system/layouts/onecol/layout--onecol.html.twig similarity index 100% copy from core/modules/layout_discovery/layouts/onecol/layout--onecol.html.twig copy to core/modules/system/layouts/onecol/layout--onecol.html.twig diff --git a/core/modules/layout_discovery/layouts/onecol/onecol.css b/core/modules/system/layouts/onecol/onecol.css similarity index 100% copy from core/modules/layout_discovery/layouts/onecol/onecol.css copy to core/modules/system/layouts/onecol/onecol.css diff --git a/core/modules/layout_discovery/layouts/threecol_25_50_25/layout--threecol-25-50-25.html.twig b/core/modules/system/layouts/threecol_25_50_25/layout--threecol-25-50-25.html.twig similarity index 100% copy from core/modules/layout_discovery/layouts/threecol_25_50_25/layout--threecol-25-50-25.html.twig copy to core/modules/system/layouts/threecol_25_50_25/layout--threecol-25-50-25.html.twig diff --git a/core/modules/layout_discovery/layouts/threecol_25_50_25/threecol_25_50_25.css b/core/modules/system/layouts/threecol_25_50_25/threecol_25_50_25.css similarity index 100% copy from core/modules/layout_discovery/layouts/threecol_25_50_25/threecol_25_50_25.css copy to core/modules/system/layouts/threecol_25_50_25/threecol_25_50_25.css diff --git a/core/modules/layout_discovery/layouts/threecol_33_34_33/layout--threecol-33-34-33.html.twig b/core/modules/system/layouts/threecol_33_34_33/layout--threecol-33-34-33.html.twig similarity index 100% copy from core/modules/layout_discovery/layouts/threecol_33_34_33/layout--threecol-33-34-33.html.twig copy to core/modules/system/layouts/threecol_33_34_33/layout--threecol-33-34-33.html.twig diff --git a/core/modules/layout_discovery/layouts/threecol_33_34_33/threecol_33_34_33.css b/core/modules/system/layouts/threecol_33_34_33/threecol_33_34_33.css similarity index 100% copy from core/modules/layout_discovery/layouts/threecol_33_34_33/threecol_33_34_33.css copy to core/modules/system/layouts/threecol_33_34_33/threecol_33_34_33.css diff --git a/core/modules/layout_discovery/layouts/twocol/layout--twocol.html.twig b/core/modules/system/layouts/twocol/layout--twocol.html.twig similarity index 100% copy from core/modules/layout_discovery/layouts/twocol/layout--twocol.html.twig copy to core/modules/system/layouts/twocol/layout--twocol.html.twig diff --git a/core/modules/layout_discovery/layouts/twocol/twocol.css b/core/modules/system/layouts/twocol/twocol.css similarity index 100% copy from core/modules/layout_discovery/layouts/twocol/twocol.css copy to core/modules/system/layouts/twocol/twocol.css diff --git a/core/modules/layout_discovery/layouts/twocol_bricks/layout--twocol-bricks.html.twig b/core/modules/system/layouts/twocol_bricks/layout--twocol-bricks.html.twig similarity index 100% copy from core/modules/layout_discovery/layouts/twocol_bricks/layout--twocol-bricks.html.twig copy to core/modules/system/layouts/twocol_bricks/layout--twocol-bricks.html.twig diff --git a/core/modules/layout_discovery/layouts/twocol_bricks/twocol_bricks.css b/core/modules/system/layouts/twocol_bricks/twocol_bricks.css similarity index 100% copy from core/modules/layout_discovery/layouts/twocol_bricks/twocol_bricks.css copy to core/modules/system/layouts/twocol_bricks/twocol_bricks.css diff --git a/core/modules/layout_discovery/layout_discovery.layouts.yml b/core/modules/system/system.layouts.yml similarity index 87% rename from core/modules/layout_discovery/layout_discovery.layouts.yml rename to core/modules/system/system.layouts.yml index 98b1ed6..a17d5e1 100644 --- a/core/modules/layout_discovery/layout_discovery.layouts.yml +++ b/core/modules/system/system.layouts.yml @@ -2,7 +2,7 @@ layout_onecol: label: 'One column' path: layouts/onecol template: layout--onecol - library: layout_discovery/onecol + library: system/drupal.layout.onecol category: 'Columns: 1' default_region: content regions: @@ -13,7 +13,7 @@ layout_twocol: label: 'Two column' path: layouts/twocol template: layout--twocol - library: layout_discovery/twocol + library: system/drupal.layout.twocol category: 'Columns: 2' default_region: left regions: @@ -30,7 +30,7 @@ layout_twocol_bricks: label: 'Two column bricks' path: layouts/twocol_bricks template: layout--twocol-bricks - library: layout_discovery/twocol_bricks + library: system/drupal.layout.twocol_bricks category: 'Columns: 2' default_region: middle regions: @@ -53,7 +53,7 @@ layout_threecol_25_50_25: label: 'Three column 25/50/25' path: layouts/threecol_25_50_25 template: layout--threecol-25-50-25 - library: layout_discovery/threecol_25_50_25 + library: system/drupal.layout.threecol_25_50_25 category: 'Columns: 3' default_region: left regions: @@ -72,7 +72,7 @@ layout_threecol_33_34_33: label: 'Three column 33/34/33' path: layouts/threecol_33_34_33 template: layout--threecol-33-34-33 - library: layout_discovery/threecol_33_34_33 + library: system/drupal.layout.threecol_33_34_33 category: 'Columns: 3' default_region: left regions: diff --git a/core/modules/system/system.libraries.yml b/core/modules/system/system.libraries.yml index 98eb283..e8e9365 100644 --- a/core/modules/system/system.libraries.yml +++ b/core/modules/system/system.libraries.yml @@ -80,3 +80,29 @@ drupal.system.date: - core/drupalSettings - core/jquery.once - core/drupal.form + +drupal.layout.onecol: + version: VERSION + css: + theme: + layouts/onecol/onecol.css: {} +drupal.layout.twocol_bricks: + version: VERSION + css: + theme: + layouts/twocol_bricks/twocol_bricks.css: {} +drupal.layout.twocol: + version: VERSION + css: + theme: + layouts/twocol/twocol.css: {} +drupal.layout.threecol_25_50_25: + version: VERSION + css: + theme: + layouts/threecol_25_50_25/threecol_25_50_25.css: {} +drupal.layout.threecol_33_34_33: + version: VERSION + css: + theme: + layouts/threecol_33_34_33/threecol_33_34_33.css: {} diff --git a/core/modules/system/system.module b/core/modules/system/system.module index a1a6b71..eb49824 100644 --- a/core/modules/system/system.module +++ b/core/modules/system/system.module @@ -268,7 +268,7 @@ function system_theme() { ], 'template' => 'entity-add-list', ], - ]); + ], \Drupal::service('plugin.manager.core.layout')->getThemeImplementations()); } /** @@ -377,6 +377,19 @@ function template_preprocess_entity_add_list(&$variables) { } /** + * Prepares variables for layout templates. + * + * @param array &$variables + * An associative array containing: + * - content: An associative array containing the properties of the element. + * Properties used: #settings, #layout. + */ +function template_preprocess_layout(&$variables) { + $variables['settings'] = isset($variables['content']['#settings']) ? $variables['content']['#settings'] : []; + $variables['layout'] = isset($variables['content']['#layout']) ? $variables['content']['#layout'] : []; +} + +/** * @defgroup authorize Authorized operations * @{ * Functions to run operations with elevated privileges via authorize.php. diff --git a/core/modules/layout_discovery/templates/layout.html.twig b/core/modules/system/templates/layout.html.twig similarity index 100% copy from core/modules/layout_discovery/templates/layout.html.twig copy to core/modules/system/templates/layout.html.twig diff --git a/core/modules/layout_discovery/tests/src/Kernel/LayoutTest.php b/core/tests/Drupal/KernelTests/Core/Layout/LayoutTest.php similarity index 97% rename from core/modules/layout_discovery/tests/src/Kernel/LayoutTest.php rename to core/tests/Drupal/KernelTests/Core/Layout/LayoutTest.php index 9d4c446..a82a7f0 100644 --- a/core/modules/layout_discovery/tests/src/Kernel/LayoutTest.php +++ b/core/tests/Drupal/KernelTests/Core/Layout/LayoutTest.php @@ -1,6 +1,6 @@