yii\helpers\BaseHtml::activeRadioList PHP Method

activeRadioList() public static method

A radio button list is like a checkbox list, except that it only allows single selection. The selection of the radio buttons is taken from the value of the model attribute.
public static activeRadioList ( Model $model, string $attribute, array $items, array $options = [] ) : string
$model yii\base\Model the model object
$attribute string the attribute name or expression. See [[getAttributeName()]] for the format about attribute expression.
$items array the data item used to generate the radio buttons. The array keys are the radio values, and the array values are the corresponding labels. Note that the labels will NOT be HTML-encoded, while the values will.
$options array options (name => config) for the radio button list container tag. The following options are specially handled: - tag: string|false, the tag name of the container element. False to render radio button without container. See also [[tag()]]. - unselect: string, the value that should be submitted when none of the radio buttons is selected. You may set this option to be null to prevent default value submission. If this option is not set, an empty string will be submitted. - encode: boolean, whether to HTML-encode the checkbox labels. Defaults to true. This option is ignored if `item` option is set. - separator: string, the HTML code that separates items. - itemOptions: array, the options for generating the radio button tag using [[radio()]]. - item: callable, a callback that can be used to customize the generation of the HTML code corresponding to a single item in $items. The signature of this callback must be: ```php function ($index, $label, $name, $checked, $value) ``` where $index is the zero-based index of the radio button in the whole list; $label is the label for the radio button; and $name, $value and $checked represent the name, value and the checked status of the radio button input. See [[renderTagAttributes()]] for details on how attributes are being rendered.
return string the generated radio button list
    public static function activeRadioList($model, $attribute, $items, $options = [])
    {
        return static::activeListInput('radioList', $model, $attribute, $items, $options);
    }