news-bundle/src/EventListener/PreviewUrlConvertListener.php
public function onPreviewUrlConvert(PreviewUrlConvertEvent $event): void
    {
        if (!$this->framework->isInitialized()) {
            return;
        }

        $request = $this->requestStack->getCurrentRequest();

        if (null === $request || null === ($news = $this->getNewsModel($request))) {
            return;
        }

        /** @var News $newsAdapter */
        $newsAdapter = $this->framework->getAdapter(News::class);

        $event->setUrl($request->getSchemeAndHttpHost().'/'.$newsAdapter->generateNewsUrl($news));
    }
public function onPreviewUrlConvert(PreviewUrlConvertEvent $event): void
    {
        if (!$this->framework->isInitialized()) {
            return;
        }

        $request = $this->requestStack->getCurrentRequest();

        if (null === $request || null === ($news = $this->getNewsModel($request))) {
            return;
        }

        /** @var News $newsAdapter */
        $newsAdapter = $this->framework->getAdapter(News::class);

        $event->setUrl($request->getSchemeAndHttpHost().'/'.$newsAdapter->generateNewsUrl($news));
    }
public function onPreviewUrlConvert ( PreviewUrlConvertEvent $ event ) : void { if ( ! $ this -> framework -> isInitialized ( ) ) { return ; } $ request = $ this -> requestStack -> getCurrentRequest ( ) ; if ( null === $ request || null === ( $ news = $ this -> getNewsModel ( $ request ) ) ) { return ; } /** @var News $newsAdapter */ $ newsAdapter = $ this -> framework -> getAdapter ( News :: class ) ; $ event -> setUrl ( $ request -> getSchemeAndHttpHost ( ) . '/' . $ newsAdapter -> generateNewsUrl ( $ news ) ) ; }
Adds the front end preview URL to the event.
Adds the front end preview URL to the event .