script WIP

This commit is contained in:
Qiang Xue
2013-04-15 22:59:13 -04:00
parent 9edc942caf
commit 0416e01414
5 changed files with 78 additions and 10 deletions

View File

@ -56,6 +56,11 @@ class Application extends Module
* If this is false, layout will be disabled.
*/
public $layout = 'main';
/**
* @var array list of installed extensions. The array keys are the extension names, and the array
* values are the corresponding extension root source directories or path aliases.
*/
public $extensions = array();
private $_ended = false;
@ -81,12 +86,19 @@ class Application extends Module
if (isset($config['basePath'])) {
$this->setBasePath($config['basePath']);
Yii::setAlias('@app', $this->getBasePath());
unset($config['basePath']);
Yii::$aliases['@app'] = $this->getBasePath();
} else {
throw new InvalidConfigException('The "basePath" configuration is required.');
}
if (isset($config['extensions'])) {
foreach ($config['extensions'] as $name => $path) {
Yii::setAlias("@$name", $path);
}
unset($config['extensions']);
}
$this->registerErrorHandlers();
$this->registerCoreComponents();
@ -206,7 +218,7 @@ class Application extends Module
*/
public function getVendorPath()
{
if ($this->_vendorPath !== null) {
if ($this->_vendorPath === null) {
$this->setVendorPath($this->getBasePath() . DIRECTORY_SEPARATOR . 'vendor');
}
return $this->_vendorPath;

View File

@ -28,6 +28,7 @@ class ViewContent extends Component
* @var \yii\web\AssetManager
*/
public $assetManager;
public $assetBundles;
public $title;
public $metaTags;
@ -45,7 +46,7 @@ class ViewContent extends Component
{
parent::init();
if ($this->assetManager === null) {
$this->assetManager = Yii::$app->getAssetManager();
$this->assetManager = Yii::$app->getAssets();
}
}