diff --git a/src/Layouts.php b/src/Layouts.php index 4904293..e64e0b3 100644 --- a/src/Layouts.php +++ b/src/Layouts.php @@ -26,6 +26,7 @@ * Layouts::SIDEBAR_CONTENT_SIDEBAR, * Layouts::SIDEBAR_SIDEBAR_CONTENT, * ], + * Layouts::DEFAULTLAYOUT => __genesis_return_full_width_content() * ]; * ``` * @@ -47,6 +48,7 @@ class Layouts extends Brick { const REGISTER = 'register'; const UNREGISTER = 'unregister'; + const DEFAULTLAYOUT = 'default-layout'; const FULL_WIDTH_CONTENT = 'full-width-content'; const CONTENT_SIDEBAR = 'content-sidebar'; @@ -69,6 +71,10 @@ public function apply() $unregisterConfig = $this->config->getSubConfig(self::UNREGISTER); $this->unregister($unregisterConfig->getArrayCopy()); } + + if ($this->config->hasKey(self::DEFAULTLAYOUT)) { + $this->setDefault($this->config->getKey(self::DEFAULTLAYOUT)); + } } /** @@ -94,4 +100,16 @@ protected function unregister(array $args) \genesis_unregister_layout($value); }); } + + /** + * Set a default Genesis layout. + * + * Allow a user to identify a layout as being the default layout on a new install, as well as serve as the fallback layout. + * + * @param string $layout Layout handle. + */ + protected function setDefault(string $layout) + { + \genesis_set_default_layout($layout); + } }