From 599e198e8961398065ef13e0fcc7a858571db5ff Mon Sep 17 00:00:00 2001 From: maks Date: Fri, 17 Aug 2018 14:51:36 +0200 Subject: [PATCH] simplify code using !empty Hello @robbieaverill, please check my assumption...it's been a long time since I have last used SS (v3.2 was my last, if i remember correctly) in the following lines 438: ```php if (isset($this->templates[$action]) && $this->templates[$action] || (isset($this->templates['index']) && $this->templates['index']) || $this->template ) { return parent::getViewer($action); } ``` it looks like the 1st two (same-line) condition should be wrapped inside `()` while checking for a non-index action template .... if not just kill this PR at once. :-) if the answer is yes then we can just use `!empty(...)` which is the same as 'isset(...) + truthy check' kind regards, maks --- code/Controllers/ContentController.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/code/Controllers/ContentController.php b/code/Controllers/ContentController.php index e14d6794..dca6d5a6 100644 --- a/code/Controllers/ContentController.php +++ b/code/Controllers/ContentController.php @@ -435,8 +435,8 @@ HTML; public function getViewer($action) { // Manually set templates should be dealt with by Controller::getViewer() - if (isset($this->templates[$action]) && $this->templates[$action] - || (isset($this->templates['index']) && $this->templates['index']) + if (!empty($this->templates[$action]) + || !empty($this->templates['index']) || $this->template ) { return parent::getViewer($action);