diff --git a/core/modules/layout/layout.info b/core/modules/layout/layout.info index e6e4a66..187bfea 100644 --- a/core/modules/layout/layout.info +++ b/core/modules/layout/layout.info @@ -1,5 +1,5 @@ name = Layout -description = Provide abstract layout handling for html delivering routes. +description = Makes it possible to swap different page layouts. package = Core version = VERSION core = 8.x diff --git a/core/modules/layout/layout.module b/core/modules/layout/layout.module index 56f223c..cbc0b9d 100644 --- a/core/modules/layout/layout.module +++ b/core/modules/layout/layout.module @@ -1,6 +1,11 @@ get('plugin.manager.layout'); } -function layout_get_layout(Request $request) { +/** + * Temporary code to make Bartik work. + * + * @todo + * Make this work generally. + */ +function layout_get_layout() { global $theme; if ($theme == 'bartik') { $conf = array( diff --git a/core/modules/layout/layout/onecol/layout--onecol.tpl.php b/core/modules/layout/layout/onecol/layout--onecol.tpl.php index 73ad5b8..22cec95 100644 --- a/core/modules/layout/layout/onecol/layout--onecol.tpl.php +++ b/core/modules/layout/layout/onecol/layout--onecol.tpl.php @@ -1,15 +1,15 @@
> diff --git a/core/modules/layout/layout/twocol/layout--twocol.tpl.php b/core/modules/layout/layout/twocol/layout--twocol.tpl.php index 2cda08e..3ba70d1 100644 --- a/core/modules/layout/layout/twocol/layout--twocol.tpl.php +++ b/core/modules/layout/layout/twocol/layout--twocol.tpl.php @@ -1,15 +1,15 @@ register('plugin.manager.layout', 'Drupal\layout\Plugin\Type\LayoutManager'); } -} \ No newline at end of file +} diff --git a/core/modules/layout/lib/Drupal/layout/Plugin/Derivative/Layout.php b/core/modules/layout/lib/Drupal/layout/Plugin/Derivative/Layout.php index a598242..f7a9146 100644 --- a/core/modules/layout/lib/Drupal/layout/Plugin/Derivative/Layout.php +++ b/core/modules/layout/lib/Drupal/layout/Plugin/Derivative/Layout.php @@ -1,5 +1,10 @@ derivatives; } + /** + * Finds layout definitions by looking for layout metadata. + */ protected function iterateDirectories($dir, $provider) { $directories = new DirectoryIterator($dir); foreach ($directories as $fileinfo) { diff --git a/core/modules/layout/lib/Drupal/layout/Plugin/LayoutInterface.php b/core/modules/layout/lib/Drupal/layout/Plugin/LayoutInterface.php index 43410f8..0863a67 100644 --- a/core/modules/layout/lib/Drupal/layout/Plugin/LayoutInterface.php +++ b/core/modules/layout/lib/Drupal/layout/Plugin/LayoutInterface.php @@ -1,9 +1,27 @@ discovery = new DerivativeDiscoveryDecorator(new AnnotatedClassDiscovery('layout', 'layout')); $this->factory = new ReflectionFactory($this); } -} \ No newline at end of file +} diff --git a/core/modules/layout/lib/Drupal/layout/Plugin/layout/layout/DefaultLayout.php b/core/modules/layout/lib/Drupal/layout/Plugin/layout/layout/DefaultLayout.php index def7fdc..f9937ca 100644 --- a/core/modules/layout/lib/Drupal/layout/Plugin/layout/layout/DefaultLayout.php +++ b/core/modules/layout/lib/Drupal/layout/Plugin/layout/layout/DefaultLayout.php @@ -1,5 +1,10 @@ getDefinition(); return $definition['regions']; } - public function getCss() { + /** + * Add the CSS files associated with this layout to the page. + */ + public function addCss() { $definition = $this->getDefinition(); drupal_add_css($definition['path'] . '/' . $definition['css']); } - public function getAdminCss() { + /** + * Add the administrative CSS files associated with this layout to the page. + */ + public function addAdminCss() { $definition = $this->getDefinition(); $css = isset($definition['admin css']) ? $definition['admin css'] : $definition['css']; drupal_add_css($definition['path'] . '/' . $css); } - public function getJs() { + /** + * Add the JS files associated with this layout to the page. + */ + public function addJs() { $definition = $this->getDefinition(); if (isset($definition['js'])) { drupal_add_js($definition['path'] . '/' . $definition['js']); } } - // @todo The $regions parameter is here only temporarily. It allows the caller - // to pass already rendered regions, while layout/block configuration code - // is still in progress. + /** + * Overrides Drupal\layout\Plugin\LayoutInterface::renderLayout(). + * + * @todo + * The $regions parameter is here only temporarily. It allows the caller + * to pass already rendered regions, while layout/block configuration code + * is still in progress. + */ public function renderLayout($admin = FALSE, $regions = array()) { $definition = $this->getDefinition(); @@ -63,11 +86,11 @@ class DefaultLayout extends PluginBase implements LayoutInterface { } if (!$admin) { - $this->getCss(); - $this->getJs(); + $this->addCss(); + $this->addJs(); } else { - $this->getAdminCss(); + $this->addAdminCss(); } $template = $definition['path'] . '/' . $definition['template'] . '.tpl.php'; diff --git a/core/themes/bartik/layout/page/page.yml b/core/themes/bartik/layout/page/page.yml index 618eb73..7ed50bb 100644 --- a/core/themes/bartik/layout/page/page.yml +++ b/core/themes/bartik/layout/page/page.yml @@ -1,7 +1,7 @@ -title: Bartik +title: Bartik page category: Other -icon: bartik.png -css: bartik.css +icon: page.png +css: page.css regions: header: 'Header' help: 'Help'