vendor/ibexa/dashboard/src/lib/EventSubscriber/Block/QuickActions/CreateFormQuickActionEventSubscriber.php line 29

Open in your IDE?
  1. <?php
  2. /**
  3.  * @copyright Copyright (C) Ibexa AS. All rights reserved.
  4.  * @license For full copyright and license information view LICENSE file distributed with this source code.
  5.  */
  6. declare(strict_types=1);
  7. namespace Ibexa\Dashboard\EventSubscriber\Block\QuickActions;
  8. use Ibexa\AdminUi\UniversalDiscovery\Event\ConfigResolveEvent;
  9. use Ibexa\Contracts\Core\SiteAccess\ConfigResolverInterface;
  10. use Symfony\Component\EventDispatcher\EventSubscriberInterface;
  11. final class CreateFormQuickActionEventSubscriber implements EventSubscriberInterface
  12. {
  13.     private ConfigResolverInterface $configResolver;
  14.     public function __construct(ConfigResolverInterface $configResolver)
  15.     {
  16.         $this->configResolver $configResolver;
  17.     }
  18.     public static function getSubscribedEvents(): array
  19.     {
  20.         return [ConfigResolveEvent::NAME => [['onUDWConfigResolve', -100]]];
  21.     }
  22.     public function onUDWConfigResolve(ConfigResolveEvent $event): void
  23.     {
  24.         if ($event->getConfigName() !== 'quick_action_create_form') {
  25.             return;
  26.         }
  27.         $config $event->getConfig();
  28.         $config['starting_location_id'] = $this->configResolver->getParameter(
  29.             'form_builder.forms_location_id'
  30.         );
  31.         $event->setConfig($config);
  32.     }
  33. }