ErrorPageLoadedEvent example

$page = ErrorPage::createFrom($page);

        /** @var CmsPageCollection $pages */
        $pages = $this->cmsPageLoader->load($requestnew Criteria([$cmsErrorLayoutId])$context)->getEntities();

        if (!$pages->has($cmsErrorLayoutId)) {
            throw new PageNotFoundException($cmsErrorLayoutId);
        }

        $page->setCmsPage($pages->get($cmsErrorLayoutId));

        $this->eventDispatcher->dispatch(new ErrorPageLoadedEvent($page$context$request));

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