<?php
namespace App\Component\AdminMenu\EventSubscriber;
use App\Component\AdminMenu\Event\AbstractBuildMenuEvent;
use App\EventListener\FeatureFlagListener;
class CreditMenuSubscriber extends AbstractMenuBuildEventSubscriber
{
protected static int $priority = -90;
public function buildMenu(AbstractBuildMenuEvent $event)
{
if (!$this->checkFeatures([FeatureFlagListener::FEATURE_YEAR_SLOTS, FeatureFlagListener::FEATURE_CREDITS])) {
return;
}
$menuBuilder = $this->getMenuBuilder($event->getMenu())
->addMainItem('Credits', 'fal fa-funnel-dollar')
->addOverlay()
->addSection('Credits')
;
if ($this->checkFeatures([FeatureFlagListener::FEATURE_YEAR_SLOTS])) {
$menuBuilder->addColumn('Year slots', 'fal fa-calendar-alt')
->addItem('View yearslots', 'admin_year_slots')
->addItem('Yearslot logs', 'admin_year_slot_logs')
->end();
}
if ($this->checkFeatures([FeatureFlagListener::FEATURE_CREDITS])) {
$menuBuilder->addColumn('Credits', 'fal fa-coins')
->addItem('View credits', 'admin_credits')
->addItem('Credit logs', 'admin_credit_logs')
->end();
}
}
}