src/Contao/View/Contao2BackendView/Subscriber/MultipleHandlerSubscriber.php
public function handleOriginalOptions(GetOptionsEvent $event)
    {
        $environment = $event->getEnvironment();

        if (!$this->scopeDeterminator->currentScopeIsBackend()
            || ('select' !== $environment->getInputProvider()->getParameter('act'))
            || ('edit' !== $environment->getInputProvider()->getParameter('select'))
        ) {
            return;
        }

        $model = $event->getModel();

        if (!($propertyName = $this->getOriginalPropertyName($event->getPropertyName(), ModelId::fromModel($model)))
            || !$model->getProperty($propertyName)
        ) {
            return;
        }

        $originalWidget       = clone $event->getWidget();
        $originalWidget->id   = $propertyName;
        $originalWidget->name = $propertyName;

        $originalOptionsEvent =
            new GetOptionsEvent(
                $propertyName,
                $event->getSubPropertyName(),
                $event->getEnvironment(),
                $model,
                $originalWidget,
                $event->getOptions()
            );

        $environment->getEventDispatcher()->dispatch(GetOptionsEvent::NAME, $originalOptionsEvent);

        $event->setOptions($originalOptionsEvent->getOptions());

        $event->stopPropagation();
    }
public function handleOriginalOptions(GetOptionsEvent $event)
    {
        $environment = $event->getEnvironment();

        if (!$this->scopeDeterminator->currentScopeIsBackend()
            || ('select' !== $environment->getInputProvider()->getParameter('act'))
            || ('edit' !== $environment->getInputProvider()->getParameter('select'))
        ) {
            return;
        }

        $model = $event->getModel();

        if (!($propertyName = $this->getOriginalPropertyName($event->getPropertyName(), ModelId::fromModel($model)))
            || !$model->getProperty($propertyName)
        ) {
            return;
        }

        $originalWidget       = clone $event->getWidget();
        $originalWidget->id   = $propertyName;
        $originalWidget->name = $propertyName;

        $originalOptionsEvent =
            new GetOptionsEvent(
                $propertyName,
                $event->getSubPropertyName(),
                $event->getEnvironment(),
                $model,
                $originalWidget,
                $event->getOptions()
            );

        $environment->getEventDispatcher()->dispatch(GetOptionsEvent::NAME, $originalOptionsEvent);

        $event->setOptions($originalOptionsEvent->getOptions());

        $event->stopPropagation();
    }
public function handleOriginalOptions ( GetOptionsEvent $ event ) { $ environment = $ event -> getEnvironment ( ) ; if ( ! $ this -> scopeDeterminator -> currentScopeIsBackend ( ) || ( 'select' !== $ environment -> getInputProvider ( ) -> getParameter ( 'act' ) ) || ( 'edit' !== $ environment -> getInputProvider ( ) -> getParameter ( 'select' ) ) ) { return ; } $ model = $ event -> getModel ( ) ; if ( ! ( $ propertyName = $ this -> getOriginalPropertyName ( $ event -> getPropertyName ( ) , ModelId :: fromModel ( $ model ) ) ) || ! $ model -> getProperty ( $ propertyName ) ) { return ; } $ originalWidget = clone $ event -> getWidget ( ) ; $ originalWidget -> id = $ propertyName ; $ originalWidget -> name = $ propertyName ; $ originalOptionsEvent = new GetOptionsEvent ( $ propertyName , $ event -> getSubPropertyName ( ) , $ event -> getEnvironment ( ) , $ model , $ originalWidget , $ event -> getOptions ( ) ) ; $ environment -> getEventDispatcher ( ) -> dispatch ( GetOptionsEvent :: NAME , $ originalOptionsEvent ) ; $ event -> setOptions ( $ originalOptionsEvent -> getOptions ( ) ) ; $ event -> stopPropagation ( ) ; }
Handle the original widget options.

@param GetOptionsEvent $event The event.

@return void
Handle the original widget options .