yii\bootstrap\ToggleButtonGroup::renderItem PHP Method

renderItem() public method

Default callback for checkbox/radio list item rendering.
See also: Html::checkbox()
See also: Html::radio()
public renderItem ( integer $index, string $label, string $name, boolean $checked, string $value ) : string
$index integer item index.
$label string item label.
$name string input name.
$checked boolean whether value is checked or not.
$value string input value.
return string generated HTML.
    public function renderItem($index, $label, $name, $checked, $value)
    {
        $labelOptions = $this->labelOptions;
        Html::addCssClass($labelOptions, 'btn');
        if ($checked) {
            Html::addCssClass($labelOptions, 'active');
        }
        $type = $this->type;
        if ($this->encodeLabels) {
            $label = Html::encode($label);
        }
        return Html::$type($name, $checked, ['label' => $label, 'labelOptions' => $labelOptions, 'value' => $value]);
    }
ToggleButtonGroup