Gentics Portal.Node PHP API
 All Classes Namespaces Functions Variables Pages
BaseWidget.php
1 <?php
2 /**
3  *
4  */
5 class BaseWidget extends CWidget
6 {
7  /**
8  * Overridden function for using widget views from custom section
9  *
10  * @param string $viewName view name
11  *
12  * @return mixed|string
13  */
14  public function getViewFile($viewName)
15  {
16  $viewFile = parent::getViewFile($viewName);
17  if (isset(Yii::app()->params['customViews']) && Yii::app()->params['customViews'] == true) {
18  $customSection = realpath(Yii::getPathOfAlias('site.custom'));
19  $commonSection = realpath(Yii::getPathOfAlias('site.common'));
20  $frontendSection = realpath(Yii::getPathOfAlias('site.frontend'));
21  $customView = str_replace(array($commonSection, $frontendSection), $customSection, $viewFile);
22  if (file_exists($customView)) {
23  return $customView;
24  }
25  }
26  return $viewFile;
27  }
28 }