From bcc1e0e77b50a420926453b0864554f182d92650 Mon Sep 17 00:00:00 2001 From: Hans-Joachim Michl Date: Wed, 30 Aug 2017 17:05:32 +0200 Subject: [PATCH 1/3] Error in template selection Using $this->template here is just plain wrong! You want to use the $name argument here too of course! Using $this->template breaks custom actions like so: ...$this->Crud->mapAction('account', [ 'className' => 'Crud.Edit', 'view' => 'edit' ]); function account() { return $this->Crud->execute(); } If there should be a valid case to use $this->template too, we need another try/catch block i suppose. --- src/View/CrudView.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/View/CrudView.php b/src/View/CrudView.php index 56a590f2..6d9bd41d 100644 --- a/src/View/CrudView.php +++ b/src/View/CrudView.php @@ -201,7 +201,7 @@ protected function _getViewFileName($name = null) $this->subDir = null; $this->templatePath = 'Scaffold'; - return parent::_getViewFileName($this->template); + return parent::_getViewFileName($name); } } } From ccb53d0e452172f2cbcb2cde8ae9176b2274eef3 Mon Sep 17 00:00:00 2001 From: Hans-Joachim Michl Date: Wed, 30 Aug 2017 17:50:51 +0200 Subject: [PATCH 2/3] Like so? Or the second try inside the first catch block? Or an empty first catch block? --- src/View/CrudView.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/View/CrudView.php b/src/View/CrudView.php index 6d9bd41d..6713f80f 100644 --- a/src/View/CrudView.php +++ b/src/View/CrudView.php @@ -200,8 +200,12 @@ protected function _getViewFileName($name = null) } catch (MissingTemplateException $exception) { $this->subDir = null; $this->templatePath = 'Scaffold'; - + } + try { + return parent::_getViewFileName($this->template); + } catch (MissingTemplateException $exception) { return parent::_getViewFileName($name); } + } } From 2667370052769e015c425e50ea21adec43c970e2 Mon Sep 17 00:00:00 2001 From: Hans-Joachim Michl Date: Wed, 30 Aug 2017 17:59:33 +0200 Subject: [PATCH 3/3] CS fix --- src/View/CrudView.php | 1 - 1 file changed, 1 deletion(-) diff --git a/src/View/CrudView.php b/src/View/CrudView.php index 6713f80f..cb19d3dc 100644 --- a/src/View/CrudView.php +++ b/src/View/CrudView.php @@ -206,6 +206,5 @@ protected function _getViewFileName($name = null) } catch (MissingTemplateException $exception) { return parent::_getViewFileName($name); } - } }