我试图让左侧有一个自定义顺序(不是按字母顺序排列)。我有更多的Bundles,每个捆绑包都有自定义services.yml
。在每个.yml中我都有我想要的订单,但是Sonata为每个组制作了一个自定义订单(A-Z)。如何提供当前的索引订单?我不想将所有代码都放入app/config/services.yml
imports:
- { resource: parameters.yml }
- { resource: security.yml }
- { resource: services.yml }
- { resource: currencies.yml }
- { resource: '@XYZBundle/Resources/config/services.yml' }
XYZBundle / Resource / config / services.yml内容:
services:
xyz.admin.entity.one:
class: XYZBundle\Admin\EntityAdmin_1
arguments: [~, XYZBundle\Entity\Entity_1, AppBundle:CRUD]
tags:
-
name: sonata.admin
manager_type: orm
label: Entity One
audit: true
public: true
xyz.admin.entity.two:
class: XYZBundle\Admin\EntityAdmin_2
arguments: [~, XYZBundle\Entity\Entity_2, AppBundle:CRUD]
tags:
-
name: sonata.admin
manager_type: orm
label: Entity Two
audit: true
public: true
xyz.admin.entity.three:
class: XYZBundle\Admin\EntityAdmin_3
arguments: [~, XYZBundle\Entity\Entity_3, AppBundle:CRUD]
tags:
-
name: sonata.admin
manager_type: orm
label: Entity Three
audit: true
public: true
app / config / config.yml
sonata_admin:
dashboard:
groups:
loan.admin:
label: Custom XYZ
icon: '<i class="fa fa-dollar"></i>'
items:
- xyz.admin.entity.one
- xyz.admin.entity.two
- xyz.admin.entity.three
这就是它的样子。 (机密实体名称)
答案 0 :(得分:0)
sonata_admin:
templates:
# default global templates
layout: SonataAdminBundle::layout.html.twig
title_logo: images/logo.png
title: Your title
dashboard:
groups:
identifier.for.this.group:
label: Your Label
icon: '<i class="fa fa-globe"></i>'
items:
- sonata.admin.service_name
该服务是奏鸣曲的标准服务
sonata.admin.service_name:
class: AppBundle\Admin\YourSonataAdminClass
tags:
- { name: sonata.admin, manager_type: orm, label: "Your Label" }
arguments:
- ~
- AppBundle\Entity\AsociatedEntity
- ~
答案 1 :(得分:0)
我已经这样订购了菜单组:
->首先,您应该具有一个易于记忆的特定组名(仪表板,帐单等),并在 config / services.yaml 中进行配置:
....
App\Admin\OrderAdmin:
arguments: [~, App\Entity\Order, App\Controller\ActionAdminController]
tags:
- { name: sonata.admin, manager_type: orm, group: dashboard, label: Orders }
App\Admin\RequestAdmin:
arguments: [~, App\Entity\Request, App\Controller\ActionAdminController]
tags:
- { name: sonata.admin, manager_type: orm, group: dashboard,label: Request }
App\Admin\clientAdmin:
arguments: [~, App\Entity\Client, App\Controller\ActionAdminController]
tags:
- { name: sonata.admin, manager_type: orm, group: dashboard,label: "client" }
App\Admin\BillAdmin:
arguments: [~, App\Entity\Bill, App\Controller\ActionAdminController]
tags:
- { name: sonata.admin, manager_type: orm, group: bill, label: 'Bill clients' }
public: true
App\Admin\DailyBillAdmin:
arguments: [~, App\Entity\DailyBill, App\Controller\ActionAdminController]
tags:
- { name: sonata.admin, manager_type: orm, group: bill, label: 'Daily Bills' }
App\Admin\OlderBillAdmin:
arguments: [~, App\Entity\OlderBill, App\Controller\ActionAdminController]
tags:
- { name: sonata.admin, manager_type: orm, group: bill, label: 'Older Bills clients' }
public: true
App\Admin\ConfigurationAdmin:
arguments: [~, App\Entity\Configuration, ~]
tags:
- { name: sonata.admin, manager_type: orm,group: configuration, label: 'Configuration Taxes' }
App\Admin\UserAdmin:
arguments: [~, App\Entity\User, App\Controller\ActionAdminController]
tags:
- { name: sonata.admin, manager_type: orm,group: users, label: 'User Management' }
.....
,然后您可以在 config / packages / sonata_admin.yaml 中轻松订购组名称,例如:
sonata_admin:
title: 'Your Title'
dashboard:
blocks:
- { type: sonata.admin.block.admin_list, position: left }
groups:
dashboard:
label: DASHBOARD
bill:
label: BILLS
configuration:
label: CONFIGURATIONs
users:
label: USERS
......
,如果您想将项目重新排序到组中,也可以不重新排列到组中,则可以使用项目选项。这是该文档:documentation