コード例 #1
0
ファイル: DatePicker.php プロジェクト: diginova/yii2-metronic
 /**
  * Initializes the widget.
  */
 public function init()
 {
     parent::init();
     if ($this->inline && !isset($this->containerOptions['id'])) {
         $this->containerOptions['id'] = $this->options['id'] . '-container';
     } else {
         Html::addCssClass($this->options, 'form-control form-control-inline');
     }
 }
コード例 #2
0
 /**
  * Initializes the widget.
  */
 public function init()
 {
     parent::init();
     $this->options['multiple'] = true;
     if ($this->disabled) {
         $this->options['disabled'] = true;
     }
     Html::addCssClass($this->options, 'multi-select');
 }
コード例 #3
0
ファイル: Select2.php プロジェクト: diginova/yii2-metronic
 /**
  * Initializes the widget.
  */
 public function init()
 {
     parent::init();
     Html::addCssClass($this->options, 'form-control');
     if ($this->multiple) {
         $this->options['multiple'] = 'multiple';
     }
     if ($this->disabled) {
         $this->options['disabled'] = true;
     }
 }
コード例 #4
0
 /**
  * Initializes the widget.
  */
 public function init()
 {
     parent::init();
     $items = [];
     if ($this->hasModel()) {
         $this->_checked = array_map('trim', explode(',', $this->model->{$this->attribute}));
         foreach ($this->items as $item) {
             $input = [];
             if (is_string($item)) {
                 $input['name'] = $item;
                 $input['label'] = $this->model->getAttributeLabel($item);
             } else {
                 if (!isset($item['name'])) {
                     throw new InvalidConfigException('Option "name" is required.');
                 }
                 $input['name'] = $item['name'];
                 $input['label'] = isset($item['label']) ? $item['label'] : $this->model->getAttributeLabel($item['name']);
             }
             $items[] = $input;
         }
     } else {
         $this->_checked = array_map('trim', explode(',', $this->value));
         foreach ($this->items as $item) {
             $input = [];
             if (is_string($item)) {
                 $input['name'] = $item;
                 $input['label'] = Inflector::camel2words($item);
             } else {
                 if (!isset($item['name'])) {
                     throw new InvalidConfigException('Option "name" is required.');
                 }
                 $input['name'] = $item['name'];
                 $input['label'] = isset($item['label']) ? $item['label'] : Inflector::camel2words($item['name']);
             }
             $items[] = $input;
         }
     }
     $this->items = $items;
 }