Final Class Yiisoft\Html\Widget\ButtonGroup
| Inheritance | Yiisoft\Html\Widget\ButtonGroup |
|---|---|
| Implements | Yiisoft\Html\NoEncodeStringableInterface |
ButtonGroup represents a group of buttons.
Public Methods
| Method | Description | Defined By |
|---|---|---|
| __toString() | Yiisoft\Html\Widget\ButtonGroup | |
| addButtonAttributes() | Yiisoft\Html\Widget\ButtonGroup | |
| buttonAttributes() | Yiisoft\Html\Widget\ButtonGroup | |
| buttons() | Yiisoft\Html\Widget\ButtonGroup | |
| buttonsData() | Yiisoft\Html\Widget\ButtonGroup | |
| containerAttributes() | Yiisoft\Html\Widget\ButtonGroup | |
| containerTag() | Yiisoft\Html\Widget\ButtonGroup | |
| create() | Yiisoft\Html\Widget\ButtonGroup | |
| disabled() | Yiisoft\Html\Widget\ButtonGroup | |
| form() | Specifies the form element the buttons belongs to. The value of this attribute must be the ID attribute of a form element in the same document. | Yiisoft\Html\Widget\ButtonGroup |
| render() | Yiisoft\Html\Widget\ButtonGroup | |
| separator() | Yiisoft\Html\Widget\ButtonGroup | |
| withoutContainer() | Yiisoft\Html\Widget\ButtonGroup |
Method Details
| public self addButtonAttributes ( array $attributes ) | ||
| $attributes | array | |
public function addButtonAttributes(array $attributes): self
{
$new = clone $this;
$new->buttonAttributes = array_merge($new->buttonAttributes, $attributes);
return $new;
}
| public self containerAttributes ( array $attributes ) | ||
| $attributes | array | |
public function containerAttributes(array $attributes): self
{
$new = clone $this;
$new->containerAttributes = $attributes;
return $new;
}
| public self containerTag ( string|null $name ) | ||
| $name | string|null | |
public function containerTag(?string $name): self
{
$new = clone $this;
$new->containerTag = $name;
return $new;
}
| public self disabled ( boolean|null $disabled = true ) | ||
| $disabled | boolean|null | |
public function disabled(?bool $disabled = true): self
{
$new = clone $this;
$new->buttonAttributes['disabled'] = $disabled;
return $new;
}
Specifies the form element the buttons belongs to. The value of this attribute must be the ID attribute of a form element in the same document.
| public self form ( string|null $id ) | ||
| $id | string|null |
ID of a form. |
public function form(?string $id): self
{
$new = clone $this;
$new->buttonAttributes['form'] = $id;
return $new;
}
| public string render ( ) |
public function render(): string
{
if (empty($this->buttons)) {
return '';
}
if (empty($this->buttonAttributes)) {
$lines = $this->buttons;
} else {
$lines = [];
foreach ($this->buttons as $button) {
$lines[] = $button->unionAttributes($this->buttonAttributes);
}
}
$html = [];
if (!empty($this->containerTag)) {
$html[] = Html::openTag($this->containerTag, $this->containerAttributes);
}
$html[] = implode($this->separator, $lines);
if (!empty($this->containerTag)) {
$html[] = Html::closeTag($this->containerTag);
}
return implode("\n", $html);
}
| public self separator ( string $separator ) | ||
| $separator | string | |
public function separator(string $separator): self
{
$new = clone $this;
$new->separator = $separator;
return $new;
}
| public self withoutContainer ( ) |
public function withoutContainer(): self
{
return $this->containerTag(null);
}
Signup or Login in order to comment.