Sulu\Component\Webspace\Analyzer\RequestAnalyzerInterface::getPortalInformation PHP Method

getPortalInformation() public method

Returns portal-information of request.
public getPortalInformation ( ) : PortalInformation
return Sulu\Component\Webspace\PortalInformation
    public function getPortalInformation();

Usage Example

Example #1
0
 /**
  * Appends analytics scripts into body.
  *
  * @param FilterResponseEvent $event
  */
 public function onResponse(FilterResponseEvent $event)
 {
     if (0 !== strpos($event->getResponse()->headers->get('Content-Type'), 'text/html') || $this->requestAnalyzer->getPortalInformation() === null) {
         return;
     }
     $portalUrl = $this->requestAnalyzer->getAttribute('urlExpression');
     $analytics = $this->analyticsRepository->findByUrl($portalUrl, $this->requestAnalyzer->getPortalInformation()->getWebspaceKey(), $this->environment);
     $content = $this->engine->render('SuluWebsiteBundle:Analytics:website.html.twig', ['analytics' => $analytics]);
     $response = $event->getResponse();
     $responseContent = $response->getContent();
     $response->setContent(str_replace('</body>', $content . '</body>', $responseContent));
 }
All Usage Examples Of Sulu\Component\Webspace\Analyzer\RequestAnalyzerInterface::getPortalInformation