diff --git a/core/modules/page/layouts/static/complex/complex.yml b/core/modules/page/layouts/static/complex/complex.yml new file mode 100644 index 0000000..ec6491a --- /dev/null +++ b/core/modules/page/layouts/static/complex/complex.yml @@ -0,0 +1,2 @@ +title: Complex layout +template: complex diff --git a/core/modules/page/layouts/static/simple/simple.yml b/core/modules/page/layouts/static/simple/simple.yml new file mode 100644 index 0000000..3c395fa --- /dev/null +++ b/core/modules/page/layouts/static/simple/simple.yml @@ -0,0 +1,2 @@ +title: Simple layout +template: simple diff --git a/core/modules/page/config/page.front_page.yml b/core/modules/page/config/page.front_page.yml index 97f0dda..9c7d932 100644 --- a/core/modules/page/config/page.front_page.yml +++ b/core/modules/page/config/page.front_page.yml @@ -3,5 +3,5 @@ uuid: 5da81acf-3264-4d91-9b00-b2461c86e974 label: 'Front page' visibility: '1' paths: '' -layout: '1' +layout: 'static_layout:page__complex' langcode: und diff --git a/core/modules/page/config/page.not_admin_page.yml b/core/modules/page/config/page.not_admin_page.yml index 89e9dc9..4985493 100644 --- a/core/modules/page/config/page.not_admin_page.yml +++ b/core/modules/page/config/page.not_admin_page.yml @@ -3,5 +3,5 @@ uuid: 45e82840-d11b-4726-8d09-9be84a69457d label: 'Not admin page' visibility: '0' paths: "admin\r\nadmin/*" -layout: '2' +layout: 'static_layout:page__simple' langcode: und diff --git a/core/modules/page/config/page.user_page.yml b/core/modules/page/config/page.user_page.yml index 643a916..19e342f 100644 --- a/core/modules/page/config/page.user_page.yml +++ b/core/modules/page/config/page.user_page.yml @@ -3,5 +3,5 @@ uuid: ccd213ff-54d4-4f3a-9a00-f8406842dff0 label: 'User page' visibility: '1' paths: "user\r\nuser/*" -layout: '0' +layout: 'static_layout:page__complex' langcode: und diff --git a/core/modules/page/layouts/static/page/page.yml b/core/modules/page/layouts/static/page/page.yml deleted file mode 100644 index a4ac550..0000000 --- a/core/modules/page/layouts/static/page/page.yml +++ /dev/null @@ -1,2 +0,0 @@ -title: Page -template: page diff --git a/core/modules/page/lib/Drupal/page/PageFormController.php b/core/modules/page/lib/Drupal/page/PageFormController.php index 766cf4e..6684a61 100644 --- a/core/modules/page/lib/Drupal/page/PageFormController.php +++ b/core/modules/page/lib/Drupal/page/PageFormController.php @@ -37,13 +37,17 @@ public function form(array $form, array &$form_state, EntityInterface $page) { '#disabled' => (bool) $page->id(), ); - // @todo make this actually rely on layouts from the patch at - // http://drupal.org/node/1787846 when committed. + // Get list of layouts and expose that for page layout selection. + $layouts = drupal_container()->get('plugin.manager.layout')->getDefinitions(); + $layout_options = array(); + foreach ($layouts as $key => $layout) { + $layout_options[$key] = $layout['title']; + } $form['layout'] = array( '#type' => 'select', '#title' => t('Layout for this page'), - '#default_value' => isset($page->layout) ? $page->layout : 'foo', - '#options' => array('foo', 'bar', 'baz'), + '#default_value' => isset($page->layout) ? $page->layout : '', + '#options' => $layout_options, ); // @todo this would ideally be pluggable and depend on general conditions diff --git a/core/modules/page/page.info b/core/modules/page/page.info index ecf60f4..5abbdce 100644 --- a/core/modules/page/page.info +++ b/core/modules/page/page.info @@ -4,4 +4,5 @@ package = Core version = VERSION core = 8.x dependencies[] = config +dependencies[] = layout configure = admin/structure/pages diff --git a/core/modules/page/page.module b/core/modules/page/page.module index 81db1cf..66637be 100644 --- a/core/modules/page/page.module +++ b/core/modules/page/page.module @@ -66,7 +66,7 @@ function page_permission() { */ function page_init() { if ($page = page_get_matched_page()) { - drupal_set_message(t('%page matched', array('%page' => $page->label()))); + drupal_set_message(t('%page matched, %layout to be used.', array('%page' => $page->label(), '%layout' => $page->layout))); } }