Pimcore\Model\Site::getRootDocument PHP Method

getRootDocument() public method

public getRootDocument ( ) : Page
return Pimcore\Model\Document\Page
    public function getRootDocument()
    {
        return $this->rootDocument;
    }

Usage Example

示例#1
0
 /**
  * @param Site $site
  * @param Document $document
  * @return bool
  */
 public static function isDocumentInSite($site, $document)
 {
     $inSite = true;
     if ($site && $site->getRootDocument() instanceof Document\Page) {
         if (!preg_match("@^" . $site->getRootDocument()->getRealFullPath() . "/@", $document->getRealFullPath())) {
             $inSite = false;
         }
     }
     return $inSite;
 }