init() public method

public init ( )
示例#1
0
 /**
  * @inheritdoc
  */
 public function init()
 {
     parent::init();
     if (!in_array($this->mode, array('date', 'time', 'datetime'))) {
         throw new InvalidConfigException('Unknown mode: "' . $this->mode . '". Use time, datetime or date!');
     }
     if ($this->inline && !isset($this->containerOptions['id'])) {
         $this->containerOptions['id'] = $this->options['id'] . '-container';
     }
     if ($this->size) {
         Html::addCssClass($this->options, 'input-' . $this->size);
         Html::addCssClass($this->containerOptions, 'input-group-' . $this->size);
     }
     if ($this->language === null && ($language = Yii::$app->language) !== 'en-US') {
         $this->language = substr($language, 0, 2);
     }
     Html::addCssClass($this->options, 'form-control');
     Html::addCssClass($this->containerOptions, 'input-group ' . $this->mode);
 }