Commit b3053f43 by Dmitry Erofeev

Made Theme::basePath optional fixes #2810

parent 30d84ffb
...@@ -82,12 +82,11 @@ class Theme extends Component ...@@ -82,12 +82,11 @@ class Theme extends Component
{ {
parent::init(); parent::init();
if (($basePath = $this->getBasePath()) !== null) { if (empty($this->pathMap)) {
if (empty($this->pathMap)) { if (($basePath = $this->getBasePath()) == null) {
$this->pathMap = [Yii::$app->getBasePath() => [$basePath]]; throw new InvalidConfigException('The "basePath" property must be set.');
} }
} else { $this->pathMap = [Yii::$app->getBasePath() => [$basePath]];
throw new InvalidConfigException('The "basePath" property must be set.');
} }
} }
...@@ -172,14 +171,4 @@ class Theme extends Component ...@@ -172,14 +171,4 @@ class Theme extends Component
throw new InvalidConfigException('The "baseUrl" property must be set.'); throw new InvalidConfigException('The "baseUrl" property must be set.');
} }
} }
/**
* Converts a relative file path into an absolute one using [[basePath]].
* @param string $path the relative file path to be converted.
* @return string the absolute file path
*/
public function getPath($path)
{
return $this->getBasePath() . DIRECTORY_SEPARATOR . ltrim($path, '/\\');
}
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment