dosamigos\datepicker\DatePicker::init PHP Method

init() public method

public init ( )
    public function init()
    {
        parent::init();
        if ($this->inline) {
            $this->options['readonly'] = 'readonly';
            Html::addCssClass($this->options, 'text-center');
        }
        if ($this->size) {
            Html::addCssClass($this->options, 'input-' . $this->size);
            Html::addCssClass($this->containerOptions, 'input-group-' . $this->size);
        }
        Html::addCssClass($this->options, 'form-control');
        Html::addCssClass($this->containerOptions, 'input-group date');
    }

Usage Example

Beispiel #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);
 }