Skip to content
Browse files

Refactored last commit changes are:

To override plugin views with a themed version of the view you would create:
<app_name>/views/themed/<theme_name>/plugins/<plugin_name>/<controller_name>/*.ctp

To override plugin views at the app view level you would create:
<app_name>/views/plugins/<plugin_name>/<controller_name>/*.ctp
  • Loading branch information...
1 parent 21eb001 commit 948f6b21e5ecb35f361b0a3a043314676f46889c @phpnut phpnut committed
View
5 cake/libs/view/theme.php
@@ -59,9 +59,10 @@ function _paths($plugin = null, $cached = true) {
&& strpos($paths[$i], DS . 'libs' . DS . 'view') === false
&& strpos($paths[$i], DS . $plugin . DS) === false) {
if ($plugin) {
- $themePaths[] = $paths[$i] . 'themed'. DS . $this->theme . DS . $plugin . DS;
+ $themePaths[] = $paths[$i] . 'themed'. DS . $this->theme . DS . 'plugins' . DS . $plugin . DS;
+ } else {
+ $themePaths[] = $paths[$i] . 'themed'. DS . $this->theme . DS;
}
- $themePaths[] = $paths[$i] . 'themed'. DS . $this->theme . DS;
}
}
$paths = array_merge($themePaths, $paths);
View
2 cake/libs/view/view.php
@@ -939,7 +939,7 @@ function _paths($plugin = null, $cached = true) {
$count = count($viewPaths);
for ($i = 0; $i < $count; $i++) {
if (!isset($corePaths[$viewPaths[$i]])) {
- $paths[] = $viewPaths[$i] . $plugin . DS;
+ $paths[] = $viewPaths[$i] . 'plugins' . DS . $plugin . DS;
}
}
$paths[] = App::pluginPath($plugin) . 'views' . DS;
View
4 cake/tests/cases/libs/view/theme.test.php
@@ -207,11 +207,11 @@ function testPluginThemedGetTemplate() {
$this->Controller->theme = 'test_theme';
$ThemeView = new TestThemeView($this->Controller);
- $expected = TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'views' . DS . 'themed' . DS . 'test_theme' . DS . 'test_plugin' . DS . 'tests' . DS .'index.ctp';
+ $expected = TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'views' . DS . 'themed' . DS . 'test_theme' . DS . 'plugins' . DS . 'test_plugin' . DS . 'tests' . DS .'index.ctp';
$result = $ThemeView->getViewFileName('index');
$this->assertEqual($result, $expected);
- $expected = TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'views' . DS . 'themed' . DS . 'test_theme' . DS . 'test_plugin' . DS . 'layouts' . DS .'default.ctp';
+ $expected = TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'views' . DS . 'themed' . DS . 'test_theme' . DS . 'plugins' . DS . 'test_plugin' . DS . 'layouts' . DS .'default.ctp';
$result = $ThemeView->getLayoutFileName();
$this->assertEqual($result, $expected);
}
View
0 ...est_theme/test_plugin/layouts/default.ctp → ...e/plugins/test_plugin/layouts/default.ctp
File renamed without changes.
View
0 ...ed/test_theme/test_plugin/tests/index.ctp → ...theme/plugins/test_plugin/tests/index.ctp
File renamed without changes.

0 comments on commit 948f6b2

Please sign in to comment.
Something went wrong with that request. Please try again.