public radioList ( array $items, array $options = [] ) | ||
$items | array | the data item used to generate the radio buttons. The array values are the labels, while the array keys are the corresponding radio values. |
$options | array | options (name => config) for the radio button list. For the list of available options please refer to the `$options` parameter of [[\yii\helpers\Html::activeRadioList()]]. |
public function radioList($items, $options = [])
{
$this->adjustLabelFor($options);
$this->_skipLabelFor = true;
$this->parts['{input}'] = Html::activeRadioList($this->model, $this->attribute, $items, $options);
return $this;
}
/** * @inheritdoc */ public function radioList($items, $options = []) { if ($this->inline) { if (!isset($options['template'])) { $this->template = $this->inlineRadioListTemplate; } else { $this->template = $options['template']; unset($options['template']); } if (!isset($options['itemOptions'])) { $options['itemOptions'] = ['labelOptions' => ['class' => 'radio-inline']]; } } elseif (!isset($options['item'])) { $options['item'] = function ($index, $label, $name, $checked, $value) { return '<div class="radio">' . Html::radio($name, $checked, ['label' => $label, 'value' => $value]) . '</div>'; }; } parent::radioList($items, $options); return $this; }