未知方法 - Yii2 中的 ActiveField::radioButtonList()

Unknown Method - ActiveField::radioButtonList() in Yii2

我要在表格中显示RadioButton List

我尝试使用以下代码:

<?php
$list = [0 => 'Morning', 1 => 'Noon', 2 => 'Evening'];

/* Display a stacked checkbox list */
echo $form->field($model, 'is_active')->radioButtonList($list);
?>

但是我得到以下错误:

Unknown Method – yii\base\UnknownMethodException
Calling unknown method: yii\widgets\ActiveField::radioButtonList()

尝试:

 $list = [0 => 'Morning', 1 => 'Noon', 2 => 'Evening'];
 echo $form->field($model, 'is_active')->radioList($list); 

也许这有帮助:

<?= $form->field($ShipmentTypeForm, 'shipmenttype')
         ->radioList(['radio1'=>'radio1','radio2'=>'radio2'],['class'=>'your_class','id'=>'your_id']); ?>