Pimcore\Model\Staticroute::getCurrentRoute PHP Method

getCurrentRoute() public static method

public static getCurrentRoute ( ) : Staticroute
return Staticroute
    public static function getCurrentRoute()
    {
        return self::$_currentRoute;
    }

Usage Example

Example #1
0
 /**
  *
  */
 public function dispatchLoopShutdown()
 {
     if (!Tool::isHtmlResponse($this->getResponse())) {
         return;
     }
     if (!Tool::useFrontendOutputFilters($this->getRequest()) && !$this->getRequest()->getParam("pimcore_preview")) {
         return;
     }
     if (isset($_COOKIE["pimcore_admin_sid"])) {
         try {
             // we should not start a session here as this can break the functionality of the site if
             // the website itself uses sessions, so we include the code, and check asynchronously if the user is logged in
             // this is done by the embedded script
             $body = $this->getResponse()->getBody();
             $document = $this->getRequest()->getParam("document");
             if ($document instanceof Model\Document && !Model\Staticroute::getCurrentRoute()) {
                 $documentId = $document->getId();
             }
             if (!isset($documentId) || !$documentId) {
                 $documentId = "null";
             }
             $code = '<script type="text/javascript" src="/admin/admin-button/script?documentId=' . $documentId . '"></script>';
             // search for the end <head> tag, and insert the google analytics code before
             // this method is much faster than using simple_html_dom and uses less memory
             $bodyEndPosition = stripos($body, "</body>");
             if ($bodyEndPosition !== false) {
                 $body = substr_replace($body, $code . "\n\n</body>\n", $bodyEndPosition, 7);
             }
             $this->getResponse()->setBody($body);
         } catch (\Exception $e) {
             \Logger::error($e);
         }
     }
 }
All Usage Examples Of Pimcore\Model\Staticroute::getCurrentRoute