Skip to content

Commit

Permalink
feat: Displays parent node listing sort options if parent is a stack …
Browse files Browse the repository at this point in the history
…(hiding children)
  • Loading branch information
ambroisemaupate committed Aug 28, 2023
1 parent a43439c commit 48d06ce
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lib/RoadizCoreBundle/src/Entity/NodesSources.php
Original file line number Diff line number Diff line change
Expand Up @@ -638,12 +638,17 @@ public function isReachable(): bool
}

/**
* Returns current listing sort options OR parent node's if parent node is hiding children.
*
* @return array
*/
#[Serializer\Groups(['node_listing'])]
#[SymfonySerializer\Groups(['node_listing'])]
public function getListingSortOptions(): array
{
if (null !== $this->getParent() && $this->getParent()->getNode()->isHidingChildren()) {
return $this->getParent()->getListingSortOptions();
}
return match ($this->getNode()->getChildrenOrder()) {
'position' => [
'node.position' => $this->getNode()->getChildrenOrderDirection()
Expand Down

0 comments on commit 48d06ce

Please sign in to comment.