public function getNodeFromContextPath($contextPath, Site $site = null, Domain $domain = null, $includeAll = false)
    {
        $nodePathAndContext = NodePaths::explodeContextPath($contextPath);
        $nodePath = $nodePathAndContext['nodePath'];
        $workspaceName = $nodePathAndContext['workspaceName'];
        $dimensions = $nodePathAndContext['dimensions'];

        $contextProperties = $this->prepareContextProperties($workspaceName, $dimensions);

        if ($site === null) {
            list(, , $siteNodeName) = explode('/', $nodePath);
            $site = $this->siteRepository->findOneByNodeName($siteNodeName);
        }

        if ($domain === null) {
            $domain = $this->domainRepository->findOneBySite($site);
        }

        $contextProperties['currentSite'] = $site;
        $contextProperties['currentDomain'] = $domain;
        if ($includeAll === true) {
            $contextProperties['invisibleContentShown'] = true;
            $contextProperties['removedContentShown'] = true;
        }

        $context = $this->contextFactory->create(
            $contextProperties
        );

        $workspace = $context->getWorkspace(false);
        if (!$workspace) {
            return new Error(
                sprintf('Could not convert the given source to Node object because the workspace "%s" as specified in the context node path does not exist.', $workspaceName), 1451392329);
        }

        return $context->getNode($nodePath);
    }
public function getNodeFromContextPath($contextPath, Site $site = null, Domain $domain = null, $includeAll = false)
    {
        $nodePathAndContext = NodePaths::explodeContextPath($contextPath);
        $nodePath = $nodePathAndContext['nodePath'];
        $workspaceName = $nodePathAndContext['workspaceName'];
        $dimensions = $nodePathAndContext['dimensions'];

        $contextProperties = $this->prepareContextProperties($workspaceName, $dimensions);

        if ($site === null) {
            list(, , $siteNodeName) = explode('/', $nodePath);
            $site = $this->siteRepository->findOneByNodeName($siteNodeName);
        }

        if ($domain === null) {
            $domain = $this->domainRepository->findOneBySite($site);
        }

        $contextProperties['currentSite'] = $site;
        $contextProperties['currentDomain'] = $domain;
        if ($includeAll === true) {
            $contextProperties['invisibleContentShown'] = true;
            $contextProperties['removedContentShown'] = true;
        }

        $context = $this->contextFactory->create(
            $contextProperties
        );

        $workspace = $context->getWorkspace(false);
        if (!$workspace) {
            return new Error(
                sprintf('Could not convert the given source to Node object because the workspace "%s" as specified in the context node path does not exist.', $workspaceName), 1451392329);
        }

        return $context->getNode($nodePath);
    }
public function getNodeFromContextPath ( $ contextPath , Site $ site = null , Domain $ domain = null , $ includeAll = false ) { $ nodePathAndContext = NodePaths :: explodeContextPath ( $ contextPath ) ; $ nodePath = $ nodePathAndContext [ 'nodePath' ] ; $ workspaceName = $ nodePathAndContext [ 'workspaceName' ] ; $ dimensions = $ nodePathAndContext [ 'dimensions' ] ; $ contextProperties = $ this -> prepareContextProperties ( $ workspaceName , $ dimensions ) ; if ( $ site === null ) { list ( , , $ siteNodeName ) = explode ( '/' , $ nodePath ) ; $ site = $ this -> siteRepository -> findOneByNodeName ( $ siteNodeName ) ; } if ( $ domain === null ) { $ domain = $ this -> domainRepository -> findOneBySite ( $ site ) ; } $ contextProperties [ 'currentSite' ] = $ site ; $ contextProperties [ 'currentDomain' ] = $ domain ; if ( $ includeAll === true ) { $ contextProperties [ 'invisibleContentShown' ] = true ; $ contextProperties [ 'removedContentShown' ] = true ; } $ context = $ this -> contextFactory -> create ( $ contextProperties ) ; $ workspace = $ context -> getWorkspace ( false ) ; if ( ! $ workspace ) { return new Error ( sprintf ( 'Could not convert the given source to Node object because the workspace "%s" as specified in the context node path does not exist.' , $ workspaceName ) , 1451392329 ) ; } return $ context -> getNode ( $ nodePath ) ; }
Converts a given context path to a node object

@param string $contextPath
@return NodeInterface|Error
Converts a given context path to a node object