From 6f576bf17769ec6318a5f2b303ca5d492a5af000 Mon Sep 17 00:00:00 2001 From: Mateusz Zalewski Date: Wed, 8 May 2024 11:57:27 +0200 Subject: [PATCH] Packagings menu --- config/packages/packaging.yaml | 10 ++++++++++ config/services.yaml | 2 +- src/Packaging/Menu/AdminMenuListener.php | 22 ++++++++++++++++++++++ translations/messages.en.yaml | 3 +++ 4 files changed, 36 insertions(+), 1 deletion(-) create mode 100644 src/Packaging/Menu/AdminMenuListener.php create mode 100644 translations/messages.en.yaml diff --git a/config/packages/packaging.yaml b/config/packages/packaging.yaml index 674c638..aed7bd1 100644 --- a/config/packages/packaging.yaml +++ b/config/packages/packaging.yaml @@ -8,3 +8,13 @@ sylius_fixtures: name: packaging options: amount: 10 + +services: + App\Packaging\: + resource: '../../src/Packaging/*' + autowire: true + autoconfigure: true + + App\Packaging\Menu\AdminMenuListener: + tags: + - { name: kernel.event_listener, event: sylius.menu.admin.main, method: addPackagingsMenu } diff --git a/config/services.yaml b/config/services.yaml index adee36b..f39631c 100644 --- a/config/services.yaml +++ b/config/services.yaml @@ -21,7 +21,7 @@ services: # this creates a service per class whose id is the fully-qualified class name App\: resource: '../src/*' - exclude: '../src/{Entity,Migrations,Tests,Kernel.php}' + exclude: '../src/{Entity,Packaging,Migrations,Tests,Kernel.php}' # Controllers are imported separately to make sure services can be injected # as action arguments even if you don't extend any base controller class diff --git a/src/Packaging/Menu/AdminMenuListener.php b/src/Packaging/Menu/AdminMenuListener.php new file mode 100644 index 0000000..36a09f9 --- /dev/null +++ b/src/Packaging/Menu/AdminMenuListener.php @@ -0,0 +1,22 @@ +getMenu(); + $catalogSubmenu = $menu->getChild('catalog'); + + $catalogSubmenu + ->addChild('packagings', ['route' => 'app_admin_packaging_index']) + ->setLabel('app.ui.packagings') + ->setLabelAttribute('icon', 'box') + ; + } +} diff --git a/translations/messages.en.yaml b/translations/messages.en.yaml new file mode 100644 index 0000000..42deea9 --- /dev/null +++ b/translations/messages.en.yaml @@ -0,0 +1,3 @@ +app: + ui: + packagings: 'Packagings'