From ac1872855880cb943e61e5e24094328dd3cf2caf Mon Sep 17 00:00:00 2001 From: ADmad Date: Sun, 30 Aug 2015 18:42:55 +0530 Subject: [PATCH] Check theme property only for View instance and return early. --- src/View/CellTrait.php | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/src/View/CellTrait.php b/src/View/CellTrait.php index eff1947bc9c..3ce555cf430 100644 --- a/src/View/CellTrait.php +++ b/src/View/CellTrait.php @@ -109,21 +109,25 @@ protected function _createCell($className, $action, $plugin, $options) if (!empty($plugin)) { $builder->plugin($plugin); } - if (!empty($this->theme)) { - $builder->theme($this->theme); - } if (!empty($this->helpers)) { $builder->helpers($this->helpers); $instance->helpers = $this->helpers; } - if (isset($this->viewClass)) { - $builder->className($this->viewClass); - $instance->viewClass = $this->viewClass; - } + if ($this instanceof View) { + if (!empty($this->theme)) { + $builder->theme($this->theme); + } + $class = get_class($this); $builder->className($class); $instance->viewClass = $class; + return $instance; + } + + if (isset($this->viewClass)) { + $builder->className($this->viewClass); + $instance->viewClass = $this->viewClass; } return $instance; }