yii\widgets\InputWidget::init PHP Method

init() public method

If you override this method, make sure you call the parent implementation first.
public init ( )
    public function init()
    {
        if ($this->name === null && !$this->hasModel()) {
            throw new InvalidConfigException("Either 'name', or 'model' and 'attribute' properties must be specified.");
        }
        if (!isset($this->options['id'])) {
            $this->options['id'] = $this->hasModel() ? Html::getInputId($this->model, $this->attribute) : $this->getId();
        }
        parent::init();
    }

Usage Example

Ejemplo n.º 1
2
 public function init()
 {
     $this->id = $this->hasModel() ? Html::getInputId($this->model, $this->attribute) : $this->id;
     $this->_options = ['serverUrl' => Url::to(['upload']), 'initialFrameWidth' => '100%', 'initialFrameHeight' => '300', 'lang' => strtolower(Yii::$app->language) == 'en-us' ? 'en' : 'zh-cn'];
     $this->clientOptions = ArrayHelper::merge($this->_options, $this->clientOptions);
     parent::init();
 }
All Usage Examples Of yii\widgets\InputWidget::init
InputWidget