SalutationRouteRequestEvent example

$page->setSalutations($this->getSalutations($salesChannelContext$request));

        $this->eventDispatcher->dispatch(
            new AccountProfilePageLoadedEvent($page$salesChannelContext$request)
        );

        return $page;
    }

    private function getSalutations(SalesChannelContext $context, Request $request): SalutationCollection
    {
        $event = new SalutationRouteRequestEvent($requestnew Request()$contextnew Criteria());
        $this->eventDispatcher->dispatch($event);

        $salutations = $this->salutationRoute
            ->load($event->getStoreApiRequest()$context$event->getCriteria())
            ->getSalutations();

        return $this->salutationsSorter->sort($salutations);
    }
}
Home | Imprint | This part of the site doesn't use cookies.