Add the event filter to search.

@param FilterCollectionEvent $event The filter collection event.

@return void
495364
public function addEventFilter(FilterCollectionEvent $event): void
    {
        $now = new \DateTime();
        $qb = $event->getQueryBuilder();
        $query = $qb->query()->bool()
            ->addMust($qb->query()->term(['_index' => 'event']))
            ->addMust($qb->query()->term(['active' => true]))
            ->addMust($qb->query()->terms('groups.id', $event->getGroupIds()))
            ->addMustNot($qb->query()->exists('schedule'))
        ;
        $event->addFilter($query);
    }
594529
public function onKernelResponse(FilterResponseEvent $event)
    {
        $event->getResponse()->headers->set(self::HEADER_NAME, $this->requestId->get());
    }
381785
public function beforeFilter(Event $event)
    {
        $this->viewBuilder()->className(Configure::read('CA.viewClass'))->theme(Configure::read('CA.theme'));

        if ($this->authUser) {
            $this->viewBuilder()->layout(Configure::read('CA.layout.default'));
        } else {
            $this->viewBuilder()->layout(Configure::read('CA.layout.login'));
        }

        $this->_addNotificationMenu();

        $event = new Event('CakeAdmin.Controller.beforeFilter', $this);
        EventManager::instance()->dispatch($event);
    }
521225
public boolean filter(Event event) {
        LOG.info("StringContentFilter called");
        
        if (wordsToFilter != null) {
            for (String filterWord : wordsToFilter) {
                if (event.getContent() != null
                        && -1 != event.getContent().indexOf(filterWord)) {
                    return true;
                }
            }
        }
        return false;
    }
236537
public function attach(\Zend_EventManager_EventCollection $events)
    {
        $this->listeners[] = $events->attach(self::EVENT_PRE, array($this, 'load'), 100);
        $this->listeners[] = $events->attach(self::EVENT_POST, array($this, 'save'), -100);
        $this->listeners[] = $events->attach(self::EVENT_REMOVE, array($this, 'remove'), 50);
        $this->listeners[] = $events->attach(self::EVENT_CLEAN, array($this, 'clean'), 0);
    }
227136
public function beforeFilter(\Cake\Event\Event $event)
    {
        parent::beforeFilter($event);

        $this->loadModel(Configure::read('CM.UserModel'));
    }
924321
public function onKernelResponse(FilterResponseEvent $event)
    {
        $master = $event->isMasterRequest();
        if ($this->onlyMasterRequests && !$master) {
            return;
        }

        if ($this->onlyException && null === $this->exception) {
            return;
        }

        $request = $event->getRequest();
        $exception = $this->exception;
        $this->exception = null;

        if (null !== $this->matcher && !$this->matcher->matches($request)) {
            return;
        }

        if (!$profile = $this->profiler->collect($request, $event->getResponse(), $exception)) {
            return;
        }

        $this->profiles[$request] = $profile;

        $this->parents[$request] = $this->requestStack->getParentRequest();
    }
1249675
public function filter(EventInterface $event)
    {
        $result = $this->filter->filter($event);
        if ($result === null) {
            return null;
        }
        return !$result;
    }
769016
public function onPostRender(FilterPostRenderEvent $event): void
    {
        foreach ($this->registry->getTemplateFilters() as $filter) {
            if (null !== ($mailRendered = $event->getMailRendered())
                    && $filter->supports($mailRendered)) {
                $filter->filter($mailRendered);
            }
        }
    }
1344498
private void filterLogEvent(final LogEvent logEvent) {
        for ( ILogEventFilter filter: this.filters) {
            // do nothing if one of the filters doesn't accept the event
            if ( !filter.acceptEvent( logEvent ) ) {
                return;
            }
        }
        // if all the filters accepted the event, signal the creation
        // of the event
        logEventCreated( logEvent );
    }
1262030
public function onKernelController(FilterControllerEvent $event)
    {
        $controllerDefinition = $event->getController();
        $controller = $controllerDefinition[0];

        if (
            !$controller instanceof SecuredControllerInterface &&
            !$controller instanceof SecuredObjectControllerInterface
        ) {
            return;
        }

        $request = $event->getRequest();

        // find appropriate permission type for request
        $permission = '';

        switch ($request->getMethod()) {
            case 'GET':
                $permission = PermissionTypes::VIEW;
                break;
            case 'POST':
                if ('postAction' == $controllerDefinition[1]) { // means that the ClassResourceInterface has to be used
                    $permission = PermissionTypes::ADD;
                } else {
                    $permission = PermissionTypes::EDIT;
                }
                break;
            case 'PUT':
            case 'PATCH':
                $permission = PermissionTypes::EDIT;
                break;
            case 'DELETE':
                $permission = PermissionTypes::DELETE;
                break;
        }

        $securityContext = null;
        $locale = $controller->getLocale($request);
        $objectType = null;
        $objectId = null;

        if ($controller instanceof SecuredObjectControllerInterface) {
            $objectType = $controller->getSecuredClass();
            $objectId = $controller->getSecuredObjectId($request);
        }

        // check permission
        if ($controller instanceof SecuredControllerInterface) {
            $securityContext = $controller->getSecurityContext();
        }

        if (null !== $securityContext) {
            $this->securityChecker->checkPermission(
                new SecurityCondition($securityContext, $locale, $objectType, $objectId),
                $permission
            );
        }
    }
289201
public function onFilterBuilderPrepare(PrepareEvent $event)
    {
        $qb = $event->getQueryBuilder();

        $queryClasses = array(
            'Doctrine\ORM\QueryBuilder'          => 'Lexik\Bundle\FormFilterBundle\Filter\Doctrine\ORMQuery',
            'Doctrine\DBAL\Query\QueryBuilder'   => 'Lexik\Bundle\FormFilterBundle\Filter\Doctrine\DBALQuery',
            'Doctrine\ODM\MongoDB\Query\Builder' => 'Lexik\Bundle\FormFilterBundle\Filter\Doctrine\MongodbQuery',
        );

        foreach ($queryClasses as $builderClass => $queryClass) {
            if (class_exists($builderClass) && $qb instanceof $builderClass) {
                $query = new $queryClass($qb, $this->getForceCaseInsensitivity($qb), $this->encoding);

                $event->setFilterQuery($query);
                $event->stopPropagation();

                return;
            }
        }
    }
164137
public function addEvent($collection, array $event = array())
    {
        $event['event_collection'] = $collection;
        $event['projectId'] = $this->getConfig('projectId');
        $event['writeKey'] = $this->getKeyForWriting();

        $command = parent::getCommand('addEvent', $event);

        return $this->execute($command);
    }
1273941
public function beforeFilter($event)
    {
        $this->Controller->authUser = $this->Controller->Auth->user();

        // beforeFilter-event
        $_event = new Event('Component.Manager.beforeFilter', $this, [
        ]);
        $this->Controller->eventManager()->dispatch($_event);

        // beforeFilter-event for prefixes
        if ($this->isPrefix()) {
            $this->_runCallback("beforeFilter", $event);

            // beforeFilter-event with Prefix
            $this->_runEvent("beforeFilter");
        }

        $this->__loadHelpers();
    }
434208
public function onKernelResponse(FilterResponseEvent $event): void
    {
        if (!$event->isMasterRequest()) {
            return;
        }

        $blockView = $event->getRequest()->attributes->get('ngbmView');
        if (!$blockView instanceof BlockViewInterface) {
            return;
        }

        $this->tagger->tagBlock($event->getResponse(), $blockView->getBlock());
    }
1159115
public function onKernelResponse(FilterResponseEvent $event)
    {
        if (HttpKernelInterface::MASTER_REQUEST !== $event->getRequestType()) {
            return;
        }

        $this->turbolinks->decorateResponse($event->getRequest(), $event->getResponse());
    }
337106
public function collectControllerData(FilterControllerEvent $event)
    {
        if (HttpKernelInterface::SUB_REQUEST === $event->getRequestType()) {
            return;
        }

        $controller = $this->getClassName($event->getController()[0]);
        $action     = $event->getController()[1];

        $this->setController($controller);
        $this->setAction($action);
    }