/** * Extends CWidgets getViewFile by possibilty to get also themed version * of a dotted view Filename * * @param string $viewName name of the view (without file extension) * @return string the view file path. False if the view file does not exist * @see CApplication::findLocalizedFile */ public function getViewFile($viewName) { // a path alias e.g. application.modules.x.y.z. if (strpos($viewName, '.') && ($theme = Yii::app()->getTheme()) !== null) { $themedFile = $theme->getViewFileAliased($viewName); if ($themedFile) { return $themedFile; } } return parent::getViewFile($viewName); }
/** * Extends CWidgets getViewFile by possibilty to get also themed version * of a dotted view Filename * * @param string $viewName name of the view (without file extension) * @return string the view file path. False if the view file does not exist * @see CApplication::findLocalizedFile */ public function getViewFile($viewName) { // a path alias e.g. application.modules.x.y.z. if (strpos($viewName, '.')) { if (($theme = Yii::app()->getTheme()) !== null) { // Replace application.modules[_core].MODULEID.widgets.views // in // webroot.themes.CURRENTTHEME.views.MODULEID.widgets $viewNameTheme = $viewName; $viewNameTheme = str_replace('application.views.', 'webroot.themes.' . $theme->getName() . '.views.', $viewNameTheme); $viewNameTheme = preg_replace('/application\\.modules(?:_core)?\\.(.*?)\\.views\\.(.*)/i', 'webroot.themes.' . $theme->getName() . '.views.\\1.\\2', $viewNameTheme); #$viewNameTheme = preg_replace('/widgets\.views/', 'widgets', $viewNameTheme); $viewFile = Yii::getPathOfAlias($viewNameTheme); // Check if File exists if (is_file($viewFile . '.php')) { return Yii::app()->findLocalizedFile($viewFile . '.php'); } } // Fall Back to default } return parent::getViewFile($viewName); }