yii\web\AssetManager::init PHP Метод

init() публичный Метод

Initializes the component.
public init ( )
    public function init()
    {
        parent::init();
        $this->basePath = Yii::getAlias($this->basePath);
        if (!is_dir($this->basePath)) {
            throw new InvalidConfigException("The directory does not exist: {$this->basePath}");
        } elseif (!is_writable($this->basePath)) {
            throw new InvalidConfigException("The directory is not writable by the Web process: {$this->basePath}");
        } else {
            $this->basePath = realpath($this->basePath);
        }
        $this->baseUrl = rtrim(Yii::getAlias($this->baseUrl), '/');
    }

Usage Example

Пример #1
0
 /**
  * @inheritdoc
  */
 public function init()
 {
     parent::init();
     if ($this->useCdn) {
         $this->baseUrl = Yii::$app->cdnManager->getBaseUrl() . '/' . Yii::getAlias('@kalibao/app') . '/' . $this->baseUrl;
     } else {
         $this->baseUrl = '/' . $this->baseUrl;
     }
 }