/** * Return all possible paths to find view files in order * * This method overrides cakephp's default method because it doesn't allow * to override themes by default * * @param string|null $plugin Optional plugin name to scan for view files. * @param bool $cached Set to false to force a refresh of view paths. Default true. * @return array paths */ protected function _paths($plugin = null, $cached = true) { $paths = parent::_paths($plugin, $cached); $templatePaths = App::path('Template'); $themeOverridePaths = []; if (!empty($this->theme)) { for ($i = 0, $count = count($templatePaths); $i < $count; $i++) { $themeOverridePaths[] = $templatePaths[$i] . $this->theme . DS; if ($plugin) { $themedPluginOverride = end($themeOverridePaths) . 'Plugin' . DS . $plugin . DS; array_unshift($themeOverridePaths, $themedPluginOverride); } } } $paths = array_merge($themeOverridePaths, $paths); return $this->_paths = $paths; }
/** * Initialization hook method. * * Use this method to add common initialization code like loading helpers. * * e.g. `$this->loadHelper('Html');` * * @return void */ public function initialize() { parent::initialize(); }