Skip to content

Commit

Permalink
Packagings menu
Browse files Browse the repository at this point in the history
  • Loading branch information
Zales0123 committed May 15, 2024
1 parent a738d8b commit 6f576bf
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 1 deletion.
10 changes: 10 additions & 0 deletions config/packages/packaging.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
2 changes: 1 addition & 1 deletion config/services.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
22 changes: 22 additions & 0 deletions src/Packaging/Menu/AdminMenuListener.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?php

declare(strict_types=1);

namespace App\Packaging\Menu;

use Sylius\Bundle\UiBundle\Menu\Event\MenuBuilderEvent;

final class AdminMenuListener
{
public function addPackagingsMenu(MenuBuilderEvent $event): void
{
$menu = $event->getMenu();
$catalogSubmenu = $menu->getChild('catalog');

$catalogSubmenu
->addChild('packagings', ['route' => 'app_admin_packaging_index'])
->setLabel('app.ui.packagings')
->setLabelAttribute('icon', 'box')
;
}
}
3 changes: 3 additions & 0 deletions translations/messages.en.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
app:
ui:
packagings: 'Packagings'

0 comments on commit 6f576bf

Please sign in to comment.