private function doGetChildren(Document $document) { $children = $document->getChilds(); foreach ($children as $child) { if ($child instanceof Document\Printpage) { $this->allChildren[] = $child; } if ($child instanceof Document\Folder || $child instanceof Document\Printcontainer) { $this->doGetChildren($child); } if ($child instanceof Document\Hardlink) { if ($child->getSourceDocument() instanceof Document\Printpage) { $this->allChildren[] = $child; } $this->doGetChildren($child); } } }
/** * @param bool $unpublished * @return array|null */ public function getChilds($unpublished = false) { if ($this->childs === null) { $childs = parent::getChilds(); $sourceChilds = array(); if ($this->getChildsFromSource() && $this->getSourceDocument() && !\Pimcore::inAdmin()) { $sourceChilds = $this->getSourceDocument()->getChilds(); foreach ($sourceChilds as &$c) { $c = Document\Hardlink\Service::wrap($c); $c->setHardLinkSource($this); $c->setPath(preg_replace("@^" . preg_quote($this->getSourceDocument()->getFullpath()) . "@", $this->getFullpath(), $c->getPath())); } } $childs = array_merge($sourceChilds, $childs); $this->setChilds($childs); } return $this->childs; }
/** * @param Document $parentDocument * @return Document[] */ protected function getChilds($parentDocument) { return $parentDocument->getChilds(); }