这是我的属性
->add(
'target',
DaimChoiceType::class,
[
'required' => true,
'disabled' => $this->disabledStatus(),
'label' => 'attr.target',
'choices' => [
'common_settings.ui.yes' => 1,
'common_settings.ui.no' => 0,
],
'label_attr' => ['class' => 'radio-inline health-target-radio'],
'expanded' => true,
'multiple' => false,
]
)
这是我的代码
{% if viewMode is defined %}
{% set disabled = {'attr':{'disabled': 'disabled'}} %}
{% endif %}
{{ form_row(form.healthInsuranceType.target, disabled) }} // disabled attribute not working here
{{ form_row(form.healthInsuranceType.issueDate, disabled) }} //disabled attribute working here
请帮我解决symfony中的问题