Browse Source

Made Theme::basePath optional fixes #2810

tags/2.0.0-beta
Dmitry Erofeev 11 years ago
parent
commit
b3053f4346
  1. 17
      framework/base/Theme.php

17
framework/base/Theme.php

@ -82,13 +82,12 @@ class Theme extends Component
{
parent::init();
if (($basePath = $this->getBasePath()) !== null) {
if (empty($this->pathMap)) {
$this->pathMap = [Yii::$app->getBasePath() => [$basePath]];
}
} else {
if (($basePath = $this->getBasePath()) == null) {
throw new InvalidConfigException('The "basePath" property must be set.');
}
$this->pathMap = [Yii::$app->getBasePath() => [$basePath]];
}
}
private $_baseUrl;
@ -172,14 +171,4 @@ class Theme extends Component
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, '/\\');
}
}

Loading…
Cancel
Save