<?php
namespace App\Menu;
use Sylius\Bundle\UiBundle\Menu\Event\MenuBuilderEvent;
final class AccountMenuListener
{
private $fidelium_his_activate;
public function __construct(
$fidelium_his_activate
) {
$this->fidelium_his_activate = $fidelium_his_activate;
}
public function addAccountMenuItems(MenuBuilderEvent $event): void
{
$fidelium_his_activate = $this->fidelium_his_activate;
$menu = $event->getMenu();
//$menusales = $menu->getChild("sales");
$menu->removeChild('dashboard');
$items_reorder_menu = array();
$items_reorder_menu["order_history"] = $menu->getChild("order_history");
$items_reorder_menu["personal_information"] = $menu->getChild("personal_information");
$items_reorder_menu["address_book"] = $menu->getChild("address_book");
$items_reorder_menu["change_password"] = $menu->getChild("change_password");
$menu->removeChild('order_history');
$menu->removeChild('personal_information');
$menu->removeChild('address_book');
$menu->removeChild('change_password');
$menu->addChild($items_reorder_menu["order_history"]);
$menu->addChild($items_reorder_menu["personal_information"]);
$menu->addChild($items_reorder_menu["address_book"]);
$menu->addChild($items_reorder_menu["change_password"]);
//personal_information
//change_password
//address_book
//order_history
//$items_menu = $menu->getChildren();
//dashboard
if ($fidelium_his_activate=="1")
{
$menu
->addChild('new', ['route' => 'fidelium_list_action'])
->setLabel('sylius.ui.programmefidelium')
->setLabelAttribute('icon', 'star')
;
}
}
}