diff --git a/core/modules/layout/layout.admin.inc b/core/modules/layout/layout.admin.inc
index 53ac47b527c..63fe122378b 100644
--- a/core/modules/layout/layout.admin.inc
+++ b/core/modules/layout/layout.admin.inc
@@ -17,11 +17,11 @@
* @see layout_menu()
*/
function layout_page_view($key) {
- $layout = layout_manager()->getDefinition($key);
+ $layout = Drupal::service('plugin.manager.layout')->getDefinition($key);
drupal_set_title(t('View template %name', array('%name' => $layout['title'])), PASS_THROUGH);
// Render the layout in an admin context with region demonstrations.
- $instance = layout_manager()->createInstance($key, array());
+ $instance = Drupal::service('plugin.manager.layout')->createInstance($key, array());
$regions = $instance->getRegions();
foreach ($regions as $region => $info) {
$regions[$region] = '
' . check_plain($info['label']) . '
';
diff --git a/core/modules/layout/layout.module b/core/modules/layout/layout.module
index 17acc6d44c8..8c0f29dcd75 100644
--- a/core/modules/layout/layout.module
+++ b/core/modules/layout/layout.module
@@ -36,7 +36,7 @@ function layout_menu() {
* otherwise.
*/
function layout_user_access($key) {
- return (user_access('administer layouts') && layout_manager()->getDefinition($key));
+ return (user_access('administer layouts') && Drupal::service('plugin.manager.layout')->getDefinition($key));
}
/**
@@ -51,16 +51,6 @@ function layout_permission() {
);
}
-/**
- * Get the layout plugin manager instance.
- *
- * @return Drupal\layout\Plugin\Type\LayoutManager
- * The layout plugin manager instance.
- */
-function layout_manager() {
- return drupal_container()->get('plugin.manager.layout');
-}
-
/**
* Implements hook_theme().
*
@@ -68,7 +58,7 @@ function layout_manager() {
*/
function layout_theme($existing, $type, $theme, $path) {
$items = array();
- foreach (layout_manager()->getDefinitions() as $name => $layout) {
+ foreach (Drupal::service('plugin.manager.layout')->getDefinitions() as $name => $layout) {
$items[$layout['theme']] = array(
'variables' => array('content' => NULL),
'path' => $layout['path'],
diff --git a/core/modules/layout/lib/Drupal/layout/Plugin/Core/Entity/Display.php b/core/modules/layout/lib/Drupal/layout/Plugin/Core/Entity/Display.php
index adaf260faf0..5fbdfc83e41 100644
--- a/core/modules/layout/lib/Drupal/layout/Plugin/Core/Entity/Display.php
+++ b/core/modules/layout/lib/Drupal/layout/Plugin/Core/Entity/Display.php
@@ -179,7 +179,7 @@ class Display extends DisplayBase implements BoundDisplayInterface {
throw new \Exception(sprintf('Display "%id" had no layout plugin attached.', array('%id' => $this->id())), E_RECOVERABLE_ERROR);
}
- $this->layoutInstance = layout_manager()->createInstance($this->layout, $this->layoutSettings);
+ $this->layoutInstance = \Drupal::service('plugin.manager.layout')->createInstance($this->layout, $this->layoutSettings);
// @todo add handling for remapping if the layout could not be found
}
diff --git a/core/modules/layout/lib/Drupal/layout/Tests/LayoutDerivativesTest.php b/core/modules/layout/lib/Drupal/layout/Tests/LayoutDerivativesTest.php
index 287fb8fdd98..68ebf9e8377 100644
--- a/core/modules/layout/lib/Drupal/layout/Tests/LayoutDerivativesTest.php
+++ b/core/modules/layout/lib/Drupal/layout/Tests/LayoutDerivativesTest.php
@@ -33,7 +33,7 @@ class LayoutDerivativesTest extends WebTestBase {
* Tests for module/theme layout derivatives.
*/
function testDerivatives() {
- $manager = drupal_container()->get('plugin.manager.layout');
+ $manager = $this->container->get('plugin.manager.layout');
$definitions = $manager->getDefinitions();
$this->assertTrue(is_array($definitions), 'Definitions found.');