diff --git a/src/Menu/AdminMenuListener.php b/src/Menu/FraudPreventionMenuBuilder.php old mode 100644 new mode 100755 similarity index 77% rename from src/Menu/AdminMenuListener.php rename to src/Menu/FraudPreventionMenuBuilder.php index e9b25a5..7f5d931 --- a/src/Menu/AdminMenuListener.php +++ b/src/Menu/FraudPreventionMenuBuilder.php @@ -3,18 +3,18 @@ /* * This file has been created by developers from BitBag. * Feel free to contact us once you face any issues or want to start - * You can find more information about us on https://bitbag.io and write us - * an email on hello@bitbag.io. + * another great project. + * You can find more information about us on https://bitbag.shop and write us + * an email on mikolaj.krol@bitbag.pl. */ declare(strict_types=1); namespace BitBag\SyliusBlacklistPlugin\Menu; -use Knp\Menu\ItemInterface; use Sylius\Bundle\UiBundle\Menu\Event\MenuBuilderEvent; -final class AdminMenuListener +final class FraudPreventionMenuBuilder { public const AUTOMATIC_BLACKLISTING_CONFIGURATION_TYPE_MENU_KEY = 'automatic_blacklisting_configuration'; @@ -22,17 +22,16 @@ final class AdminMenuListener public const FRAUD_SUSPICION_TYPE_MENU_KEY = 'fraud_suspicion'; - public function addAdminMenuItems(MenuBuilderEvent $event): void + public function buildMenu(MenuBuilderEvent $menuBuilderEvent): void { - $menu = $event->getMenu(); - $this->addToCatalogMenu($menu); - } + $menu = $menuBuilderEvent->getMenu(); - private function addToCatalogMenu(ItemInterface $menu): void - { - $salesMenu = $menu->getChild('sales'); + $rootMenuItem = $menu + ->addChild('bitbag_fraud_prevention') + ->setLabel('bitbag_sylius_blacklist_plugin.ui.fraud_prevention') + ; - $salesMenu + $rootMenuItem ->addChild(self::BLACKLISTING_RULE_TYPE_MENU_KEY, [ 'route' => 'bitbag_sylius_blacklist_plugin_admin_blacklisting_rule_index', ]) @@ -40,7 +39,7 @@ private function addToCatalogMenu(ItemInterface $menu): void ->setLabelAttribute('icon', 'hand paper') ; - $salesMenu + $rootMenuItem ->addChild(self::AUTOMATIC_BLACKLISTING_CONFIGURATION_TYPE_MENU_KEY, [ 'route' => 'bitbag_sylius_blacklist_plugin_admin_automatic_blacklisting_configuration_index', ]) @@ -48,7 +47,7 @@ private function addToCatalogMenu(ItemInterface $menu): void ->setLabelAttribute('icon', 'microchip') ; - $salesMenu + $rootMenuItem ->addChild(self::FRAUD_SUSPICION_TYPE_MENU_KEY, [ 'route' => 'bitbag_sylius_blacklist_plugin_admin_fraud_suspicion_index', ]) @@ -56,7 +55,7 @@ private function addToCatalogMenu(ItemInterface $menu): void ->setLabelAttribute('icon', 'exclamation triangle') ; - $salesMenu + $rootMenuItem ->addChild(self::AUTOMATIC_BLACKLISTING_CONFIGURATION_TYPE_MENU_KEY, [ 'route' => 'bitbag_sylius_blacklist_plugin_admin_automatic_blacklisting_configuration_index', ]) diff --git a/src/Resources/config/services/menu.xml b/src/Resources/config/services/menu.xml index bf927ca..e2b0d69 100644 --- a/src/Resources/config/services/menu.xml +++ b/src/Resources/config/services/menu.xml @@ -6,8 +6,8 @@ xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd" > - - + + diff --git a/src/Resources/translations/messages.en.yml b/src/Resources/translations/messages.en.yml index aad553a..b09f055 100644 --- a/src/Resources/translations/messages.en.yml +++ b/src/Resources/translations/messages.en.yml @@ -1,7 +1,7 @@ bitbag_sylius_blacklist_plugin: ui: - blacklisting_rules: Manual blacklisting rule - fraud_suspicions: Fraud suspicion + blacklisting_rules: Blacklisting rules + fraud_suspicions: Fraud suspicions manage_blacklisting_rules: Manage blacklisting rules manage_fraud_suspicions: Manage fraud suspicions edit_fraud_suspicion: Edit fraud suspicion @@ -18,7 +18,7 @@ bitbag_sylius_blacklist_plugin: mark_suspicious: Mark suspicious mark_blacklisted: Mark blacklisted mark_neutral: Mark neutral - automatic_blacklisting_configurations: Auto-blacklisting config + automatic_blacklisting_configurations: Auto-block rules configure_automatic_blacklisting_configurations: Configure auto-blacklisitng new_automatic_blacklisting_configuration: Add new automatic blacklisting configuration edit_automatic_blacklisting_configuration: Edit automatic blacklisting configuration @@ -36,6 +36,7 @@ bitbag_sylius_blacklist_plugin: status: Status auto_generated: Auto generated manually_added: Manually added + fraud_prevention: Fraud prevention form: blacklisting_rule: name: Rule name