init() public method

public init ( )
示例#1
0
 /**
  * Initializes the widget
  *
  * @throws \yii\base\InvalidConfigException
  */
 public function init()
 {
     parent::init();
     $this->checkFormConfig();
     if (empty($this->columnSize)) {
         $this->columnSize = empty($this->form->formConfig['deviceSize']) ? self::SIZE_SMALL : $this->form->formConfig['deviceSize'];
     }
     if (isset($this->form->type)) {
         $this->_orientation = $this->form->type;
     }
     $this->initOptions();
     $this->registerAssets();
     if ($this->autoGenerateColumns) {
         $cols = count($this->attributes);
         $this->columns = $cols >= self::GRID_WIDTH ? self::GRID_WIDTH : $cols;
     }
     echo Html::beginTag($this->_tag, $this->options) . "\n";
 }
示例#2
0
 /**
  * Initializes the widget
  *
  * @throws \yii\base\InvalidConfigException
  */
 public function init()
 {
     parent::init();
     if (empty($this->dataProvider) || !$this->dataProvider instanceof \yii\data\BaseDataProvider) {
         throw new InvalidConfigException(
             "The 'dataProvider' property must be set and must be an instance of '\\yii\\data\\BaseDataProvider'."
         );
     }
     $this->initOptions();
     $this->registerAssets();
 }
示例#3
0
 /**
  * @inheritdoc
  * @throws InvalidConfigException
  */
 public function init()
 {
     parent::init();
     $dp = static::slash(BaseDataProvider::className());
     if (empty($this->dataProvider) || !$this->dataProvider instanceof BaseDataProvider) {
         throw new InvalidConfigException("The 'dataProvider' property must be set and must be an instance of '{$dp}'.");
     }
     $kvGrid = static::slash(GridView::classname());
     if (empty($this->gridClass)) {
         $this->gridClass = $kvGrid;
     } elseif ($this->gridClass !== $kvGrid && !is_subclass_of($this->gridClass, $kvGrid)) {
         throw new InvalidConfigException("The 'gridClass' must be a class which extends from '{$kvGrid}'.");
     }
     $this->initOptions();
     $this->registerAssets();
 }