<?php
namespace App\Component\AdminMenu\EventSubscriber;
use App\Component\AdminMenu\Event\AbstractBuildMenuEvent;
use App\Component\UserRole\Permission\UserRolePermission;
use App\Entity\Asset;
use App\EventListener\FeatureFlagListener;
class MediaMenuSubscriber extends AbstractMenuBuildEventSubscriber
{
protected static int $priority = -40;
public function buildMenu(AbstractBuildMenuEvent $event)
{
if (
$this->hasAccess(['ROLE_ADMIN_USER', [UserRolePermission::MASK_VIEW, Asset::class]])
&& $this->checkFeatures([FeatureFlagListener::FEATURE_MEDIA])
) {
$this->getMenuBuilder($event->getMenu())
->addMainItem('Media', 'fal fa-image', 'admin_media')
;
}
}
}