gpt4 book ai didi

php - EasyAdminBundle 实体表单字段自定义

转载 作者:可可西里 更新时间:2023-11-01 00:13:12 25 4
gpt4 key购买 nike

我试图在编辑表单中将标准的“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"...

是否有明显需要添加/修改的内容?

最佳答案

如果你想将字段设置为只读,你可能应该使用“禁用”选项:

MyEntity:
form:
fields:
- { property: 'created_at', type_options: { disabled: true } }

如果这对您不起作用,您可以尝试明确设置表单类型吗?

MyEntity:
form:
fields:
- { property: 'created_at', type: 'datetime', type_options: { widget: 'single_text' } }

关于php - EasyAdminBundle 实体表单字段自定义,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35843483/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com