【问题标题】:Silverstripe 4 admin add new FormField template not found errorSilverstripe 4 管理员添加新的 FormField 模板未找到错误
【发布时间】:2020-07-21 08:12:42
【问题描述】:

我尝试向 silverstripe 4 管理员添加一个名为“AdminButtonGroupField”的新 FormField。但它给了我这样的错误,

[User Warning] None of the following templates could be found: AdminButtonGroupField in themes "Array ( [0] => silverstripe/admin:cms-forms [1] => $default ) "

我曾尝试将模板放在不同的地方,但没有奏效。我可以把这个模板放在哪里?

谢谢。

【问题讨论】:

  • 你在放置 .ss 模板文件后运行了 ?flush=1 吗?
  • @Zauberfisch 是的,这在 cms 中很常见,当我放置自定义按钮或任何带有模板的字段时

标签: silverstripe silverstripe-4


【解决方案1】:

您可以将您的模板放入app/templates/AdminButtonGroupField.ss

通过将模板放入app/templates,它们将可供整个 SilverStripe 应用程序使用,无论您是在 CMS 还是前端。

如果您不想在前端使用模板,您可以定义一个“管理主题”并使用LeftAndMain.admin_themes 配置启用它。这对你来说可能不是必需的。

请注意,我在这里假设AdminButtonGroupField 没有命名空间,并且您在呈现字段时没有自定义其模板名称。如果您提供一些(可重现的)示例代码来解决这个问题。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2018-08-18
    • 2011-11-27
    • 1970-01-01
    • 1970-01-01
    • 2021-01-23
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多