add element siblings
This commit is contained in:
parent
eb868679c8
commit
96774d9540
3 changed files with 47 additions and 9 deletions
|
|
@ -27,10 +27,19 @@ class GetElement
|
|||
throw new NotFoundException('Element not found');
|
||||
}
|
||||
|
||||
$parentElement = $element->getParentElement();
|
||||
if ($parentElement === null) {
|
||||
$siblingElements = [$element];
|
||||
} else {
|
||||
$siblingElements = $this->elementRepository
|
||||
->findByParentElement($parentElement);
|
||||
}
|
||||
|
||||
return new GetElementResult(
|
||||
element: $element,
|
||||
childElements: $this->elementRepository
|
||||
->findByParentElement($element),
|
||||
siblingElements: $siblingElements,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue