/**
* {@inheritDoc}
*/
public function getBranch($pk = null, Condition $condition = null, $depth = 1, $scope = null, $options = null)
{
$result = null;
if (!$pk || !$pk['path']) {
return [['path' => '/', 'title' => 'Admin Access']];
} else {
if ('/' == $pk['path']) {
foreach ($this->jarves->getBundles() as $bundle) {
$item = array('path' => $bundle->getName(), 'title' => $bundle->getName());
$this->setChildren(strtolower($bundle->getName()), $item, $depth);
$result[] = $item;
}
} else {
self::normalizePath($pk['path']);
$adminUtils = new \Jarves\Admin\Utils($this->jarves);
$entryPoint = $adminUtils->getEntryPoint($pk['path']);
if ($entryPoint && $entryPoint->getChildren()) {
foreach ($entryPoint->getChildren() as $entryPoint) {
$item = array('path' => $pk['path'] . '/' . $entryPoint->getPath(), 'type' => $entryPoint->getType(), 'title' => $entryPoint->getLabel() ? $entryPoint->getLabel() : $entryPoint->getPath());
$this->setChildren($pk['path'] . '/' . $entryPoint->getPath(), $item, $depth);
$result[] = $item;
}
}
}
}
return $result;
}