1、复选框使用,form()方法的第三个参数是给表单构造器传递参数,表单构造器通过getData()方法获取数据
->add(‘rules’,‘choice’, [
‘label’ => ‘规则列表’,
‘choices’ => $this->getData(‘result’),
‘choice_options’ => [
‘wrapper’ => [‘class’ => ‘choice-wrapper’],
‘label_attr’ => [‘class’ => ‘label-class’],
],
‘selected’ => $this->getData(‘selected_list’),
‘expanded’ => true,
‘multiple’ => true
])