EasyAdminBundle 实体表单字段自定义
EasyAdminBundle entity form fields customization
我试图在编辑表单中将标准 "created_at" 字段设置为只读。在 the doc 之后您必须添加以下配置:
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"...
add/modify 有明显的东西吗?
如果您想将该字段设置为只读,您可能应该使用 "disabled" 选项:
MyEntity:
form:
fields:
- { property: 'created_at', type_options: { disabled: true } }
如果这对您不起作用,您可以尝试明确设置表单类型吗?
MyEntity:
form:
fields:
- { property: 'created_at', type: 'datetime', type_options: { widget: 'single_text' } }
我试图在编辑表单中将标准 "created_at" 字段设置为只读。在 the doc 之后您必须添加以下配置:
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"...
add/modify 有明显的东西吗?
如果您想将该字段设置为只读,您可能应该使用 "disabled" 选项:
MyEntity:
form:
fields:
- { property: 'created_at', type_options: { disabled: true } }
如果这对您不起作用,您可以尝试明确设置表单类型吗?
MyEntity:
form:
fields:
- { property: 'created_at', type: 'datetime', type_options: { widget: 'single_text' } }