From 1c8577ed34d65b2533977aa2c8e303dff381d079 Mon Sep 17 00:00:00 2001 From: phpnut Date: Mon, 3 Dec 2007 00:27:50 +0000 Subject: [PATCH] "Fixes #3675, View/ThemeView::renderElement() should reset plugin paths after rendering" git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@6111 3807eeeb-6ff5-0310-8944-8be069107fe0 --- cake/libs/view/theme.php | 28 +++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/cake/libs/view/theme.php b/cake/libs/view/theme.php index 1b6cca625..53991f405 100644 --- a/cake/libs/view/theme.php +++ b/cake/libs/view/theme.php @@ -102,6 +102,9 @@ class ThemeView extends View { function renderElement($name, $params = array(), $loadHelpers = false) { if (isset($params['plugin'])) { + $reset = array('plugin' => $this->plugin, + 'pluginPath' => $this->pluginPath, + 'pluginPaths' => $this->pluginPaths); $this->plugin = $params['plugin']; $this->pluginPath = 'plugins' . DS . $this->plugin . DS; $this->pluginPaths = array( @@ -136,18 +139,26 @@ class ThemeView extends View { if ($file) { $params = array_merge_recursive($params, $this->loaded); - return $this->_render($file, array_merge($this->viewVars, $params), $loadHelpers); - } - - if (!is_null($this->pluginPath)) { - $file = APP . $this->pluginPath . $this->themeElement . $name . $this->ext; + $return = $this->_render($file, array_merge($this->viewVars, $params), $loadHelpers); } else { - $file = VIEWS . $this->themeElement . $name . $this->ext; + if (!is_null($this->pluginPath)) { + $file = APP . $this->pluginPath . $this->themeElement . $name . $this->ext; + } else { + $file = VIEWS . $this->themeElement . $name . $this->ext; + } + + if (Configure::read() > 0) { + $return = 'Not Found: ' . $file; + } } - if (Configure::read() > 0) { - return "Not Found: " . $file; + if (isset($params['plugin'])) { + $this->plugin = $reset['plugin']; + $this->pluginPath = $reset['pluginPath']; + $this->pluginPaths = $reset['pluginPaths']; } + + return $return; } /** @@ -257,5 +268,4 @@ class ThemeView extends View { return $layoutFileName; } } - ?> \ No newline at end of file