<?php
namespace App\Component\AdminMenu\EventSubscriber;
use App\Component\AdminMenu\Event\AbstractBuildMenuEvent;
use App\Component\AdminMenu\Event\BuildVacancyMenuEvent;
use App\Component\UserRole\Permission\UserRolePermission;
use App\Entity\Option;
use App\EventListener\FeatureFlagListener;
class SearchfilterMenuSubscriber extends AbstractMenuBuildEventSubscriber
{
protected static int $priority = -10;
protected static string $eventClass = BuildVacancyMenuEvent::class;
public function buildMenu(AbstractBuildMenuEvent $event)
{
if (
$this->hasAccess(['ROLE_ADMIN_USER', [UserRolePermission::MASK_VIEW, Option::class]])
&& $this->checkFeatures([FeatureFlagListener::FEATURE_SEARCH_FILTERS])
) {
$this->getMenuBuilder($event->getMenu(), 'Vacancies')
->addMainItem('Search filters', 'fal fa-search', 'admin_options');
}
}
}