【发布时间】:2018-09-30 12:10:32
【问题描述】:
当我使用 Drupal 控制台创建自定义实体时:
drupal generate:entity:content
然后菜单路径是默认生成的,它们工作得很好,即在结构菜单中有两个条目用于列表实体和管理自定义实体,它包括管理字段、管理表单显示和管理显示。
现在,为了避免结构菜单混乱,我喜欢在路径下的 SystemController::systemAdminMenuBlockPage 下收集模块的所有自定义实体 /admin/structure/myCustoModuleGroup/myCustomEntityType
这很容易通过将“myCustoModuleGroup”插入到实体注释和 MyCustomEntityHtmlRouteProvider 的路径中。然后我更新 mymodule.links.task.yml 的 base_route
但是,管理字段等的所有子菜单都会消失。这可能是因为他们不再有正确的父母。
我想最终获得以下菜单条目:
structure->CustomModule->CustomEntity1Type->Manage Fields
structure->CustomModule->CustomEntity1Type->Manage Form Display
structure->CustomModule->CustomEntity1Type->Manage Display.
structure->CustomModule->CustomEntity2Type->Manage Fields
等等
有人能解决这个问题吗?我认为有一种方法可以在代码中更改菜单链接父级,因为它肯定是在某处声明的,但我找不到它(花了一整天的时间尝试)。
【问题讨论】:
标签: drupal menu parent drupal-8 entities