【问题标题】:在奏鸣曲编辑选项卡中编写基本 HTML
【发布时间】:2021-05-08 00:42:49
【问题描述】:

所以在我的奏鸣曲管理 CMS 中,我正在尝试添加一个名为 info 的页面

protected function configureFormFields(FormMapper $formMapper)
{
    $formMapper
            ->tab('Info')
            ->end();
}

在我的 admin.yml 中,我有这个调用:

calls:
- [ setTemplates, [{edit: admin\virtual-event-info.html.twig }]]

然后在一个树枝文件中我有这个

{% extends 'SonataAdminBundle:CRUD:base_edit.html.twig' %}
<h1>I just want to write some basic static html out here</h1>

我只想为常见问题解答写一个基本的静态 html 页面。我不想接受任何输入或要求任何数据,我只想让新人知道有关 CMS 那个部分的一些基本信息。谁能指导我如何让该 HTML 真正显示在该选项卡下?

【问题讨论】:

    标签: symfony twig sonata-admin sonata


    【解决方案1】:

    看来您应该将 html 内容放在 {% block form %} 中。这将替换扩展模板中定义的原始内容(vendor/sonata-project/admin-bundle/src/Resources/views/CRUD/base_edit_form.html.twig)。

    {% extends 'SonataAdminBundle:CRUD:base_edit.html.twig' %}
    {% block form %}
      <h1>This replaces the base edit form block content</h1>
    {% endblock %}
    

    【讨论】:

      猜你喜欢
      • 2019-10-13
      • 2018-08-11
      • 2019-02-16
      • 2019-01-14
      • 2020-12-17
      • 2019-02-12
      • 1970-01-01
      • 2015-04-02
      • 2019-05-22
      相关资源
      最近更新 更多