diff --git a/core/modules/layout/layout.admin.inc b/core/modules/layout/layout.admin.inc
index 9a1a921..b4e6c4a 100644
--- a/core/modules/layout/layout.admin.inc
+++ b/core/modules/layout/layout.admin.inc
@@ -44,32 +44,3 @@ function layout_page_list() {
t('module');
t('theme');
}
-
-/**
- * Page callback: Demonstrates a layout template.
- *
- * @param string $key
- * The key of the page layout being requested.
- *
- * @return array
- * An array as expected by drupal_render().
- *
- * @see layout_menu()
- */
-function layout_page_view($key) {
- $layout = layout_manager()->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());
- $regions = $instance->getRegions();
- foreach ($regions as $region => $info) {
- $regions[$region] = '
' . check_plain($info['label']) . '
';
- }
- $build['demonstration'] = array(
- '#type' => 'markup',
- '#markup' => $instance->renderLayout(TRUE, $regions),
- );
- $build['#attached']['css'][] = drupal_get_path('module', 'layout') . '/layout.admin.css';
- return $build;
-}
diff --git a/core/modules/layout/layout.module b/core/modules/layout/layout.module
index c6ed7ae..5e33296 100644
--- a/core/modules/layout/layout.module
+++ b/core/modules/layout/layout.module
@@ -19,11 +19,7 @@ function layout_menu() {
);
$items['admin/structure/templates/manage/%'] = array(
'title' => 'View template',
- 'page callback' => 'layout_page_view',
- 'page arguments' => array(4),
- 'access callback' => 'layout_user_access',
- 'access arguments' => array(4),
- 'file' => 'layout.admin.inc',
+ 'route_name' => 'layout_page_view',
);
return $items;
}
diff --git a/core/modules/layout/layout.routing.yml b/core/modules/layout/layout.routing.yml
new file mode 100644
index 0000000..c624954
--- /dev/null
+++ b/core/modules/layout/layout.routing.yml
@@ -0,0 +1,7 @@
+layout_page_view:
+ pattern: '/admin/structure/templates/manage/{node}'
+ defaults:
+ _content: '\Drupal\layout\Controller\LayoutController::layoutPageView'
+ requirements:
+ layout_user_access: TRUE
+
diff --git a/core/modules/layout/lib/Drupal/layout/Controller/LayoutController.php b/core/modules/layout/lib/Drupal/layout/Controller/LayoutController.php
new file mode 100644
index 0000000..b0c850b
--- /dev/null
+++ b/core/modules/layout/lib/Drupal/layout/Controller/LayoutController.php
@@ -0,0 +1,43 @@
+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());
+ $regions = $instance->getRegions();
+ foreach ($regions as $region => $info) {
+ $regions[$region] = '' . check_plain($info['label']) . '
';
+ }
+ $build['demonstration'] = array(
+ '#type' => 'markup',
+ '#markup' => $instance->renderLayout(TRUE, $regions),
+ );
+ $build['#attached']['css'][] = drupal_get_path('module', 'layout') . '/layout.admin.css';
+ return $build;
+}