Exemple #1
0
 /**
  * Initializes the widget.
  */
 public function init()
 {
     parent::init();
     if (static::TYPE_DEFAULT !== $this->type) {
         Html::addCssClass($this->options, sprintf('btn-%s', $this->type));
     }
     Html::addCssClass($this->options, $this->color);
     if (in_array($this->size, $this->_sizes)) {
         Html::addCssClass($this->options, 'btn-' . $this->size);
     }
     if ($this->disabled === true) {
         Html::addCssClass($this->options, 'disabled');
     }
     if ($this->block === true) {
         Html::addCssClass($this->options, 'btn-block');
     }
     $this->options['type'] = 'button';
 }
 public function init()
 {
     parent::init();
     $this->options['name'] = $this->name;
 }
Exemple #3
0
 /**
  * Initializes the widget.
  */
 public function init()
 {
     parent::init();
     $bootstrapTypes = [self::TYPE_PRIMARY, self::TYPE_INFO, self::TYPE_SUCCESS, self::TYPE_WARNING, self::TYPE_DANGER, self::TYPE_INVERSE, self::TYPE_LINK];
     $metronicTypes = [self::TYPE_M_DEFAULT, self::TYPE_M_RED, self::TYPE_M_BLUE, self::TYPE_M_GREEN, self::TYPE_M_YELLOW, self::TYPE_M_PURPLE, self::TYPE_M_DARK];
     if (in_array($this->type, $bootstrapTypes)) {
         Html::addCssClass($this->options, 'btn-' . $this->type);
     } elseif (in_array($this->type, $metronicTypes)) {
         Html::addCssClass($this->options, $this->type);
     } else {
         throw new InvalidConfigException("The button type is invalid.");
     }
     $sizes = [self::SIZE_MINI, self::SIZE_SMALL, self::SIZE_LARGE];
     if (in_array($this->size, $sizes)) {
         Html::addCssClass($this->options, 'btn-' . $this->size);
     }
     if ($this->disabled === true) {
         Html::addCssClass($this->options, 'disabled');
     }
     if ($this->block === true) {
         Html::addCssClass($this->options, 'btn-block');
     }
 }