/** * Renders a list of radio buttons. * 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. * @param array $items the data item used to generate the radio buttons. * The array values are the labels, while the array keys are the corresponding radio values. * Note that the labels will NOT be HTML-encoded, while the values will. * @param array $options options (name => config) for the radio button list. The following options are specially handled: * * - unselect: string, the value that should be submitted when none of the radio buttons is selected. * By setting this option, a hidden input will be generated. * - separator: string, the HTML code that separates items. * - 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: * * ~~~ * 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. * @return static the field object itself */ public function radioList($items, $options = []) { $this->adjustLabelFor($options); $this->parts['{input}'] = Html::activeRadioList($this->model, $this->attribute, $items, $options); return $this; }
public static function endPlugin($name) { $class = get_called_class(); if (!empty(self::$_states)) { list($state, $tag) = array_pop(self::$_states); if ($name === $state) { return Html::endTag($tag); } else { throw new InvalidCallException("Expecting {$class}::endPlugin({$state}), found {$class}::endPlugin({$name})"); } } else { throw new InvalidCallException("Unexpected {$class}::endPlugin() call. A matching beginPlugin() is not found."); } }