【问题标题】:How can I display User Management links on the Sonata Admin dashboard?如何在 Sonata Admin 仪表板上显示用户管理链接?
【发布时间】:2014-06-20 17:54:06
【问题描述】:

我想在我的 SonataAdmin 仪表板上呈现指向用户管理和 ACL 编辑的链接。我需要在 sonata_block 部分添加什么?另外,这些“cms”和“admin”上下文是什么?

sonata_block:
    default_contexts: [cms]
    blocks:
        # Enable the SonataAdminBundle block
        sonata.admin.block.admin_list:
            contexts:   [admin]
        # Your other blocks
        sonata.user.block.menu: ~    # used to display the menu in profile pages
        sonata.user.block.account: ~ # used to display menu option (login option)
        sonata.block.service.text: ~
        sonata.block.service.rss: ~
        sonata.block.service.imagesize:
            contexts: [admin]
    groups:
        admin.group.content:
            label: My Label
            label_catalogue: SonataAdminBundle
            items:
                - sonata.admin.????

【问题讨论】:

    标签: symfony sonata-admin symfony-sonata symfony-2.4 sonata-user-bundle


    【解决方案1】:

    请注意,cms 上下文将被重命名为 sonata_page_bundle 更合适。

    可以在特定上下文中定义每个块(即,不需要将与管理相关的块添加为 cms 块)。

    因此,如果我们为块设置上下文,则不会应用默认值,因此该块将不会在 SonataPageBundle 或使用此上下文的任何其他包中列出。

    现在,如果您想在仪表板中添加内容,您有一些选择: - 覆盖仪表板模板,以便您可以微调整体布局并添加到用户管理的链接。 - 创建一个块并将其添加到 sonata_admin 部分的块配置中。

    您可以按照以下地址的 BlockBundle 教程创建新块:http://sonata-project.org/bundles/block/master/doc/reference/your_first_block.html

    【讨论】:

    • 谢谢。我记得在早期版本的 SonataAdmin 中,与用户管理相关的块是预先定义的,您可以通过配置文件添加它们。现在不是这样了吗?
    • 另外,我如何访问 ACL 编辑器? sonata-project.org/bundles/admin/2-2/doc/_images/acl_editor.png
    • 没有办法将用户管理添加为组内的列表项(请参阅相关更新配置)?
    猜你喜欢
    • 2015-01-27
    • 2014-06-01
    • 1970-01-01
    • 2013-11-25
    • 2013-12-19
    • 2020-03-27
    • 1970-01-01
    • 1970-01-01
    • 2015-07-31
    相关资源
    最近更新 更多