renderSelectOptions() public static method
Renders the option tags that can be used by dropDownList() and listBox().
public static string renderSelectOptions ( $selection, $items, &$tagOptions = [] ) | ||
---|---|---|
$selection | string|array|null |
The selected value(s). String for single or array for multiple selection(s). |
$items | array |
The option data items. The array keys are option values, and the array values are the corresponding option labels. The array can also be nested (i.e. some array values are arrays too). For each sub-array, an option group will be generated whose label is the key associated with the sub-array. If you have a list of data models, you may convert them into the format described above using yii\helpers\ArrayHelper::map(). Note, the values and labels will be automatically HTML-encoded by this method, and the blank spaces in the labels will also be HTML-encoded. |
$tagOptions | array |
The $options parameter that is passed to the dropDownList() or listBox() call. This method will take out these elements, if any: "prompt", "options" and "groups". See more details in dropDownList() for the explanation of these elements. |
return | string |
The generated list options |
Please login to continue.