AccountNewsletterRecipientRouteRequestEvent example

return $newsletterAccountPagelet;
    }

    protected function getNewsletterRecipientStatus(
        Request $request,
        CustomerEntity $customer,
        SalesChannelContext $context
    ): string {
        $criteria = new Criteria();
        $apiRequest = new Request();

        $event = new AccountNewsletterRecipientRouteRequestEvent($request$apiRequest$context$criteria);
        $this->eventDispatcher->dispatch($event);

        $responseStruct = $this->newsletterRecipientRoute
            ->load($event->getStoreApiRequest()$context$criteria$customer);

        $status = 'undefined';
        if ($responseStruct->getAccountNewsletterRecipient()->getStatus()) {
            $status = $responseStruct->getAccountNewsletterRecipient()->getStatus();
        }

        return $status;
    }
Home | Imprint | This part of the site doesn't use cookies.