/** * Найти тему по $id($id - это диретория с темой) * @param $id string * @return $this object * @throws NotFoundHttpException * @throws \yii\base\Exception */ public function findRecordModel($id) { $config = FileHelper::requireFile(\Yii::getAlias('@themes') . '/' . $id . '/config.php'); if ($this->load(['theme' => $config], 'theme')) { return $this; } else { throw new NotFoundHttpException(); } }
/** * Получение конфигурации текущей темы * */ private function getCurrentThemeConfig() { return FileHelper::requireFile(\Yii::getAlias('@currentThemePath') . '/config.php'); }
/** * Загрузка перевода в массив JavaScript * */ private function registerTranslationsInJs() { $json = Json::encode(['system' => FileHelper::requireFile(Yii::getAlias('@vendor') . '/nagser/base/messages/' . Yii::$app->language . '/js.php')]); Yii::$app->view->registerJs('var language = ' . $json, View::POS_HEAD); }