/**
* @param bool $unpublished
* @return array|null
*/
public function getChildren($unpublished = false)
{
if ($this->childs === null) {
$childs = parent::getChildren();
$sourceChildren = [];
if ($this->getChildsFromSource() && $this->getSourceDocument() && !\Pimcore::inAdmin()) {
$sourceChildren = $this->getSourceDocument()->getChildren();
foreach ($sourceChildren as &$c) {
$c = Document\Hardlink\Service::wrap($c);
$c->setHardLinkSource($this);
$c->setPath(preg_replace("@^" . preg_quote($this->getSourceDocument()->getRealFullPath()) . "@", $this->getRealFullPath(), $c->getRealPath()));
}
}
$childs = array_merge($sourceChildren, $childs);
$this->setChildren($childs);
}
return $this->childs;
}