本文整理汇总了PHP中yii\bootstrap\Button::init方法的典型用法代码示例。如果您正苦于以下问题:PHP Button::init方法的具体用法?PHP Button::init怎么用?PHP Button::init使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类yii\bootstrap\Button
的用法示例。
在下文中一共展示了Button::init方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: init
/**
* 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';
}
示例2: init
public function init()
{
parent::init();
$this->options['name'] = $this->name;
}
示例3: init
/**
* 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');
}
}