Php EasyAdminBundle实体表单字段自定义
我正试图使编辑表单中的标准“created_at”字段为只读。您必须添加以下配置:Php EasyAdminBundle实体表单字段自定义,php,forms,symfony,symfony2-easyadmin,Php,Forms,Symfony,Symfony2 Easyadmin,我正试图使编辑表单中的标准“created_at”字段为只读。您必须添加以下配置: MyEntity: form: fields: - { property: 'created_at', type_options: { widget: 'single_text' } } 但它会抛出以下错误: An Exception was thrown while handling: The option "widget" do
MyEntity:
form:
fields:
- { property: 'created_at', type_options: { widget: 'single_text' } }
但它会抛出以下错误:
An Exception was thrown while handling: The option "widget" does not exist. Defined options are: "action", "allow_extra_fields"...
是否有明显的内容需要添加/修改?如果要将字段设置为只读,可能应该使用“禁用”选项: 如果这对您不起作用,您可以尝试显式地设置表单类型吗
MyEntity:
form:
fields:
- { property: 'created_at', type: 'datetime', type_options: { widget: 'single_text' } }
您也可以使用
只读:true
而不是disabled
,但我不知道两者之间有什么区别。是的,我必须添加类型参数。谢谢是否应该更新文档?
MyEntity:
form:
fields:
- { property: 'created_at', type: 'datetime', type_options: { widget: 'single_text' } }