Determine the filter config to use.

@param AbstractModelAwareEvent $event The event.

@return ConfigInterface|null
165359
private function determineFilterConfig(AbstractModelAwareEvent $event)
    {
        $environment  = $event->getEnvironment();
        $model        = $event->getModel();
        $dataProvider = $environment->getDataProvider($model->getProviderName());
        $definition   = $environment->getDataDefinition();
        $relationship = $definition->getModelRelationshipDefinition();

        $root = $relationship->getRootCondition();
        if (null !== $root && $root->matches($model)) {
            return $dataProvider->getEmptyConfig()->setFilter($root->getFilterArray());
        }

        $parentFilter = $relationship->getChildCondition(
            $definition->getBasicDefinition()->getParentDataProvider(),
            $model->getProviderName()
        );

        if (null !== $parentFilter) {
            $parentConfig   = $dataProvider->getEmptyConfig()->setFilter($parentFilter->getInverseFilterFor($model));
            $parentProvider = $environment->getDataProvider($parentFilter->getSourceName());
            $parent         = $parentProvider->fetchAll($parentConfig)->get(0);
            return $dataProvider->getEmptyConfig()->setFilter($parentFilter->getFilter($parent));
        }

        // Trigger BC layer in handleFallback().
        if ((null === $root) && (0 === \count($relationship->getChildConditions()))) {
            return null;
        }

        return $dataProvider->getEmptyConfig();
    }
1127004
protected function getAnnouncementsFilter(string $filter = null)
    {
        $mappingConfiguration = new PropertyMappingConfiguration();
        $mappingConfiguration->setTypeConverter($this->typeConverterObjectConverter);
        $mappingConfiguration->setTypeConverterOption(\RGU\Dvoconnector\Property\TypeConverter\ObjectConverter::class, \RGU\Dvoconnector\Property\TypeConverter\ObjectConverter::CONFIGURATION_OBJECT, $this->getDefaultAnnouncementsFilter());

        return $this->convertAnnouncementsFilter($mappingConfiguration, $filter);
    }
1249675
public function filter(EventInterface $event)
    {
        $result = $this->filter->filter($event);
        if ($result === null) {
            return null;
        }
        return !$result;
    }
727118
public function injectAccessDeniedViewModel(MvcEvent $event)
    {
        $this->config($event);
        
        $result = $event->getResult();
        
        if ($result instanceof ResponseInterface) {
            return;
        }
        
        $response = $event->getResponse();
        
        if ($response->getStatusCode() != 403) {
            return;
        }
        
        $model = new ViewModel();
        $model->setTemplate($this->template);
        
        if ($this->renderLayout == true) {
            $layout = $event->getViewModel();
            $layout->addChild($model);
        } else {
            $model->setTerminal(true);
            $event->setViewModel($model);
        }
    }
1141906
public static function getPropertyOptions(GetPropertyOptionsEvent $event)
    {
        if ($event->getOptions() !== null) {
            return;
        }

        $model = $event->getModel();

        if (!($model instanceof Model)) {
            return;
        }
        $attribute = $model->getItem()->getAttribute($event->getPropertyName());

        if (!($attribute instanceof AbstractSelect)) {
            return;
        }

        try {
            $options = $attribute->getFilterOptionsForDcGeneral();
        } catch (\Exception $exception) {
            $options = ['Error: ' . $exception->getMessage()];
        }

        $event->setOptions($options);
    }
919812
public function initialize(MvcEvent $event)
    {
        $appConfig = $event->getApplication()->getServiceManager()->get('config');
        if (array_key_exists(self::CONFIG_KEY, $appConfig)) {
            $this->configure($appConfig[self::CONFIG_KEY]);
        }
        
        $event->getApplication()
            ->getServiceManager()
            ->get('controllerPluginManager')
            ->setService($this->pluginName, $this);
    }
489780
public function addEvent(AbstractEvent $event) {
        $this->eventHandlerFactory->getHandlerForEvent($event)->addEvent($event);
        return $this;
    }
1333768
public function onDesktopParametersMenuConfigure(ConfigureMenuEvent $event)
    {
        $user = $this->tokenStorage->getToken()->getUser();

        if ('anon.' !== $user) {
            $menu = $event->getMenu();
            $menu->addChild(
                $this->translator->trans('notifications', [], 'platform'),
                ['route' => 'icap_notification_user_parameters']
            );

            return $menu;
        }
    }
1002388
public function getPanelElementTemplate(GetPanelElementTemplateEvent $event)
    {
        if (!$this->scopeDeterminator->currentScopeIsBackend()) {
            return;
        }

        if ($event->getTemplate()) {
            return;
        }

        $element = $event->getElement();

        if ($element instanceof FilterElementInterface) {
            $event->setTemplate(new ContaoBackendViewTemplate('dcbe_general_panel_filter'));
        } elseif ($element instanceof LimitElementInterface) {
            $event->setTemplate(new ContaoBackendViewTemplate('dcbe_general_panel_limit'));
        } elseif ($element instanceof SearchElementInterface) {
            $event->setTemplate(new ContaoBackendViewTemplate('dcbe_general_panel_search'));
        } elseif ($element instanceof SortElementInterface) {
            $event->setTemplate(new ContaoBackendViewTemplate('dcbe_general_panel_sort'));
        } elseif ($element instanceof SubmitElementInterface) {
            $event->setTemplate(new ContaoBackendViewTemplate('dcbe_general_panel_submit'));
        }
    }
1077353
public static function getPropertyOptions(GetPropertyOptionsEvent $event)
    {
        if (null !== $event->getOptions()) {
            return;
        }

        $model = $event->getModel();

        if (!($model instanceof Model)) {
            return;
        }
        $attribute = $model->getItem()->getAttribute($event->getPropertyName());

        if (!($attribute instanceof AbstractTags)) {
            return;
        }

        try {
            $options = $attribute->getFilterOptions(null, false);
        } catch (\Exception $exception) {
            $options = ['Error: ' . $exception->getMessage()];
        }

        $event->setOptions($options);
    }
192318
public function getOptions(GetOptionsEvent $event)
    {
        if (($event->getEnvironment()->getDataDefinition()->getName() !== 'tl_metamodel_attribute')
            || ($event->getPropertyName() !== 'combinedvalues_fields')
            || ($event->getSubPropertyName() !== 'field_attribute')
        ) {
            return;
        }

        $model     = $event->getModel();
        $metaModel = $this->getMetaModelById($model->getProperty('pid'));

        if (!$metaModel) {
            return;
        }

        $result = [];
        // Add meta fields.
        $result['meta'] = self::getMetaModelsSystemColumns();

        // Fetch all attributes except for the current attribute.
        foreach ($metaModel->getAttributes() as $attribute) {
            if ($attribute->get('id') === $model->getId()) {
                continue;
            }

            $type = $event
                ->getEnvironment()
                ->getTranslator()
                ->translate('typeOptions.'.$attribute->get('type'), 'tl_metamodel_attribute');

            if ($type == 'typeOptions.'.$attribute->get('type')) {
                $type = $attribute->get('type');
            }

            $result['attributes'][$attribute->getColName()] = \sprintf(
                '%s [%s]',
                $attribute->getName(),
                $type
            );
        }

        $event->setOptions($result);
    }
182658
public function resolve($event)
    {
        if ($event instanceof UserEvent) {
            return $this->getEventDetailsArray($event->getUser()->getUsername());
        }

        return null;
    }
1188570
private function handleRegister(AbstractMappingEvent $event)
    {
        $node = $event->getNode();
        $locale = $event->getLocale();

        if (!$this->documentRegistry->hasNode($node, $locale)) {
            $this->documentRegistry->registerDocument($event->getDocument(), $node, $locale);
        }
    }
252208
public function onKernelController(FilterControllerEvent $event)
    {
        $controller = $event->getController();
        $request = $event->getRequest();
        $configurations = [];

        if ($configuration = $request->attributes->get('_converters')) {
            foreach (\is_array($configuration) ? $configuration : [$configuration] as $configuration) {
                $configurations[$configuration->getName()] = $configuration;
            }
        }

        if (\is_array($controller)) {
            $r = new \ReflectionMethod($controller[0], $controller[1]);
        } elseif (\is_object($controller) && \is_callable([$controller, '__invoke'])) {
            $r = new \ReflectionMethod($controller, '__invoke');
        } else {
            $r = new \ReflectionFunction($controller);
        }

        // automatically apply conversion for non-configured objects
        if ($this->autoConvert) {
            $configurations = $this->autoConfigure($r, $request, $configurations);
        }

        $this->manager->apply($request, $configurations);
    }
954905
protected function getDefaultEventsFilter()
    {
        $filter = new EventsFilter();
        $filter->setInsideAssociationID($this->arguments[self::ARGUMENT_INSIDEASSOCIATIONID]);

        return $filter;
    }
491357
private function getSupportedAttribute($event)
    {
        $model = $event->getModel();

        // Not a metamodel model.
        if (!$model instanceof Model) {
            return null;
        }

        $property  = $event->getProperty();
        $attribute = $model->getItem()->getAttribute($property);

        if ($attribute instanceof Timestamp) {
            return $attribute;
        }

        return null;
    }
1094100
public function onTopBarLeftMenuConfigureParameters(ConfigureMenuEvent $event)
    {
        $user = $this->tokenStorage->getToken()->getUser();
        $tool = $event->getTool();

        if ($user !== 'anon.') {
            $parametersTitle = $this->translator->trans(
                'preferences',
                array(),
                'platform'
            );
            $menu = $event->getMenu();
            $menu->addChild(
                $this->translator->trans('preferences', array(), 'platform'),
                array('route' => 'claro_desktop_parameters_menu')
            )->setExtra('icon', 'fa fa-' . $tool->getClass())
            ->setExtra('title', $parametersTitle);

            return $menu;
        }
    }