Neos\ContentRepository\Eel\FlowQueryOperations\PrevOperation::getPrevForNode PHP Method

getPrevForNode() protected method

protected getPrevForNode ( Neos\ContentRepository\Domain\Model\NodeInterface $contextNode ) : Neos\ContentRepository\Domain\Model\NodeInterface
$contextNode Neos\ContentRepository\Domain\Model\NodeInterface The node for which the preceding node should be found
return Neos\ContentRepository\Domain\Model\NodeInterface The preceding node of $contextNode or NULL
    protected function getPrevForNode($contextNode)
    {
        $nodesInContext = $contextNode->getParent()->getChildNodes();
        for ($i = 0; $i < count($nodesInContext) - 1; $i++) {
            if ($nodesInContext[$i + 1] === $contextNode) {
                return $nodesInContext[$i];
            }
        }
        return null;
    }