/** * Override the default Yii controller getViewPath method. To define the template folders in where * the templates are located. Why? Basically some modules needs to put theyr templates inside of the client * repository. * * @return string */ public function getViewPath() { if ($this->module instanceof Module && $this->module->useAppViewPath) { return '@app/views/' . $this->module->id . '/' . $this->id; } return parent::getViewPath(); }
public function getViewPath() { $module = $this->module->id; if ($module === Yii::$app->id) { return parent::getViewPath(); } return Yii::getAlias('@app') . '/views/' . $module . '/' . $this->id; }
public function getViewPath() { if (!isset($this->viewPathOverride)) { return parent::getViewPath(); } else { return $this->viewPathOverride . DIRECTORY_SEPARATOR . $this->id; } }
/** * Override the default Yii controller getViewPath method. To define the template folders in where * the templates are located. Why? Basically some modules needs to put theyr templates inside of the client * repository. * * @return string */ public function getViewPath() { // if the module settings is turn to use the module view path we use them always first! if ($this->module->controllerUseModuleViewPath !== null) { $this->useModuleViewPath = $this->module->controllerUseModuleViewPath; } // use default yii behaviour if ($this->useModuleViewPath) { return parent::getViewPath(); } // use client repository specific path return '@app/views/' . $this->module->id . '/' . $this->id; }
public function render($view, $params = []) { $devicedetect = \Yii::$app->devicedetect; $isMobile = $devicedetect->isMobile(); $isTablet = $devicedetect->isTablet(); $mobileTpl = $isMobile && !$isTablet; // detect and change layout if ($mobileTpl) { $this->layout = '@app/views/layouts/sp_main'; } // detect and render view $detectView = $view . ($mobileTpl ? '_sp' : ''); $detectPath = parent::getViewPath() . "/{$detectView}.php"; return parent::render(file_exists($detectPath) ? $detectView : $view, $params); }
/** * Get view path based on module property * * @return string */ public function getViewPath() { return Yii::$app->getModule('user')->viewPath ? rtrim(Yii::$app->getModule('user')->viewPath, '/\\') . DIRECTORY_SEPARATOR . $this->id : parent::getViewPath(); }
/** * Get view path based on module property * @return string */ public function getViewPath() { return Yii::$app->getModule("golfteamplanner")->viewPath ? rtrim(Yii::$app->getModule("golfteamplanner")->viewPath, "/\\") . DIRECTORY_SEPARATOR . $this->id : parent::getViewPath(); }
public function getViewPath() { if ($this->getCart()->module->viewPath) { return Yii::getAlias($this->getCart()->module->viewPath . DIRECTORY_SEPARATOR . 'cart'); } return parent::getViewPath(); }