diff --git a/code/Controllers/ContentController.php b/code/Controllers/ContentController.php index f5ed8ba701..36ac4b97ea 100644 --- a/code/Controllers/ContentController.php +++ b/code/Controllers/ContentController.php @@ -289,14 +289,6 @@ public function getMenu($level = 1) return new ArrayList($visible); } - /** - * @return ArrayList - */ - public function Menu($level) - { - return $this->getMenu($level); - } - /** * Returns the default log-in form. * @@ -413,23 +405,23 @@ public function getViewer($action) $action = $action === 'index' ? '' : '_' . $action; $templatesFound = []; - // Find templates for the record + action together - e.g. Page_action.ss + // Find templates for the record + action together - e.g. Page_action if ($this->dataRecord instanceof SiteTree) { $templatesFound[] = $this->dataRecord->getViewerTemplates($action); } - // Find templates for the controller + action together - e.g. PageController_action.ss - $templatesFound[] = SSViewer::get_templates_by_class(static::class, $action, Controller::class); + // Find templates for the controller + action together - e.g. PageController_action + $templatesFound[] = SSViewer::get_templates_by_class(static::class, $action ?? '', Controller::class); - // Find templates for the record without an action - e.g. Page.ss + // Find templates for the record without an action - e.g. Page if ($this->dataRecord instanceof SiteTree) { $templatesFound[] = $this->dataRecord->getViewerTemplates(); } - // Find the templates for the controller without an action - e.g. PageController.ss - $templatesFound[] = SSViewer::get_templates_by_class(static::class, "", Controller::class); + // Find the templates for the controller without an action - e.g. PageController + $templatesFound[] = SSViewer::get_templates_by_class(static::class, '', Controller::class); $templates = array_merge(...$templatesFound); - return SSViewer::create($templates); + return SSViewer::create($templates, $this->getTemplateEngine()); } } diff --git a/code/Model/SiteTree.php b/code/Model/SiteTree.php index 2ee8e6b1d5..4d053e5fa0 100755 --- a/code/Model/SiteTree.php +++ b/code/Model/SiteTree.php @@ -1454,7 +1454,7 @@ public function MetaComponents() $tags['title'] = [ 'tag' => 'title', - 'content' => $this->obj('Title')->forTemplate() + 'content' => $this->obj('Title')?->forTemplate() ]; $generator = $this->getGenerator(); @@ -1601,7 +1601,7 @@ public function MetaTags($includeTitle = true) $tagString = implode("\n", $tags); if ($this->ExtraMeta) { - $tagString .= $this->obj('ExtraMeta')->forTemplate(); + $tagString .= $this->obj('ExtraMeta')?->forTemplate(); } $this->extend('updateMetaTags', $tagString); diff --git a/tests/behat/src/ThemeContext.php b/tests/behat/src/ThemeContext.php index ead1f8265d..3da77ee2a3 100644 --- a/tests/behat/src/ThemeContext.php +++ b/tests/behat/src/ThemeContext.php @@ -33,7 +33,7 @@ public function stepCreateTheme($theme) } /** - * Create a template within a test theme + * Create a template within a test theme. Only ss templates are supported. * * @Given /^a template "(?