<?php
namespace Abcpremium\AssetMetadataAssignerBundle\Event\Subscriber;
use Abcpremium\AssetMetadataAssignerBundle\Configuration\BundleConfiguration;
use Pimcore\Event\Admin\IndexActionSettingsEvent;
use Pimcore\Event\AdminEvents;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
class AddFrontendSettingsToAdminPanel implements EventSubscriberInterface
{
private BundleConfiguration $bundleConfiguration;
public function __construct(
BundleConfiguration $bundleConfiguration
) {
$this->bundleConfiguration = $bundleConfiguration;
}
/**
* {@inheritDoc}
*/
public static function getSubscribedEvents(): array
{
return [
AdminEvents::INDEX_ACTION_SETTINGS => 'addBundleSettingsToAdminPanel',
];
}
public function addBundleSettingsToAdminPanel(IndexActionSettingsEvent $event): void
{
$settings = [
'enabled' => $this->bundleConfiguration->isFrontendProcessingAllowed(),
];
$event->addSetting('abcpremiumAssetMetadataAssignerBundle', $settings);
}
}