Skip to content

Commit

Permalink
Upgrade: Update usage of app::path()
Browse files Browse the repository at this point in the history
  • Loading branch information
rchavik committed Sep 17, 2020
1 parent 75542b9 commit 96a7f76
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions Core/src/Controller/Component/CroogoComponent.php
Expand Up @@ -244,15 +244,15 @@ public function fieldToggle(Table $table, $id, $status, $field = 'status')
*/
protected function _setupViewPaths(Controller $controller)
{
$defaultViewPaths = App::path('Template');
$defaultViewPaths = App::path('templates');
$pos = array_search(APP . 'Template' . DS, $defaultViewPaths);
if ($pos !== false) {
$viewPaths = array_splice($defaultViewPaths, 0, $pos + 1);
} else {
$viewPaths = $defaultViewPaths;
}
if ($controller->viewBuilder()->getTheme()) {
$themePaths = App::path('Template', $controller->viewBuilder()->getTheme());
$themePaths = App::path('templates', $controller->viewBuilder()->getTheme());
foreach ($themePaths as $themePath) {
$viewPaths[] = $themePath;
if ($controller->getPlugin()) {
Expand All @@ -261,7 +261,7 @@ protected function _setupViewPaths(Controller $controller)
}
}
if ($controller->getPlugin()) {
$viewPaths = array_merge($viewPaths, App::path('Template', $controller->getPlugin()));
$viewPaths = array_merge($viewPaths, App::path('templates', $controller->getPlugin()));
}
$viewPaths = array_merge($viewPaths, $defaultViewPaths);

Expand All @@ -285,7 +285,7 @@ public function viewFallback($templates)
foreach ($templates as $template) {
foreach ($templatePaths as $templatePath) {
$templatePath = $templatePath . $this->_viewPath() . DS . $template;
if (file_exists($templatePath . '.ctp')) {
if (file_exists($templatePath . '.php')) {
$controller->viewBuilder()->setTemplate($this->_viewPath() . DS . $template);

return;
Expand Down
2 changes: 1 addition & 1 deletion Core/src/PluginManager.php
Expand Up @@ -151,7 +151,7 @@ public function getPlugins($type = 'plugin')
$plugins = [];
$this->folder = new Folder;
$registered = Configure::read('plugins');
$pluginPaths = Hash::merge(App::path('Plugin'), $registered);
$pluginPaths = Hash::merge(App::classPath('Plugin'), $registered);
unset($pluginPaths['Croogo']); //Otherwise we get croogo plugins twice!
foreach ($pluginPaths as $pluginName => $pluginPath) {
$this->folder->path = $pluginPath;
Expand Down
2 changes: 1 addition & 1 deletion Extensions/src/Controller/Admin/LocalesController.php
Expand Up @@ -44,7 +44,7 @@ public function index()

$locales = [];
$folder = new Folder;
$paths = App::path('Locale');
$paths = App::path('locales');
$currentLocale = I18n::getLocale();
foreach ($paths as $path) {
$folder->path = $path;
Expand Down

0 comments on commit 96a7f76

Please sign in to comment.