public function getClosestDocument(NodeInterface $node)
    {
        if ($node->getNodeType()->isOfType('Neos.Neos:Document')) {
            return $node;
        }

        $flowQuery = new FlowQuery([$node]);

        return $flowQuery->closest('[instanceof Neos.Neos:Document]')->get(0);
    }
public function getClosestDocument(NodeInterface $node)
    {
        if ($node->getNodeType()->isOfType('Neos.Neos:Document')) {
            return $node;
        }

        $flowQuery = new FlowQuery([$node]);

        return $flowQuery->closest('[instanceof Neos.Neos:Document]')->get(0);
    }
public function getClosestDocument ( NodeInterface $ node ) { if ( $ node -> getNodeType ( ) -> isOfType ( 'Neos.Neos:Document' ) ) { return $ node ; } $ flowQuery = new FlowQuery ( [ $ node ] ) ; return $ flowQuery -> closest ( '[instanceof Neos.Neos:Document]' ) -> get ( 0 ) ; }
Helper method to retrieve the closest document for a node

@param NodeInterface $node
@return NodeInterface
Helper method to retrieve the closest document for a node