bundles/Abcpremium/InspectablePdfsBundle/src/Event/AddInspectableSettingToProccessingOptions.php line 22

Open in your IDE?
  1. <?php
  2. declare(strict_types=1);
  3. namespace Abcpremium\InspectablePdfsBundle\Event;
  4. use Abcpremium\InspectablePdfsBundle\Model\Setting;
  5. use Pimcore\Event\DocumentEvents;
  6. use Pimcore\Event\Model\PrintConfigEvent;
  7. use Pimcore\Web2Print\Processor\PdfReactor;
  8. use Symfony\Component\EventDispatcher\EventSubscriberInterface;
  9. class AddInspectableSettingToProccessingOptions implements EventSubscriberInterface
  10. {
  11.     public static function getSubscribedEvents(): array
  12.     {
  13.         return [
  14.             DocumentEvents::PRINT_MODIFY_PROCESSING_OPTIONS => 'addInspectableSetting',
  15.         ];
  16.     }
  17.     public function addInspectableSetting(PrintConfigEvent $event): void
  18.     {
  19.         $processor $event->getProcessor();
  20.         if (!$processor instanceof PdfReactor) {
  21.             return;
  22.         }
  23.         $options $event->getArgument('options');
  24.         $options[] = [
  25.             'name' => Setting::INSPECTABLE_PDF,
  26.             'type' => 'bool',
  27.             'default' => false,
  28.         ];
  29.         $event->setArgument('options'$options);
  30.     }
  31. }