public function getChildren($unpublished = false)
{
if ($this->childs === null) {
$hardLink = $this->getHardLinkSource();
$children = [];
if ($hardLink->getChildrenFromSource() && $hardLink->getSourceDocument() && !\Pimcore::inAdmin()) {
foreach (parent::getChildren() as $c) {
$sourceDocument = $c;
$c = Service::wrap($c);
if ($c) {
$c->setHardLinkSource($hardLink);
$c->setSourceDocument($sourceDocument);
$c->setPath(preg_replace("@^" . preg_quote($hardLink->getSourceDocument()->getRealFullpath()) . "@", $hardLink->getRealFullpath(), $c->getRealPath()));
$children[] = $c;
}
}
}
$this->setChildren($children);
}
return $this->childs;
}