protected resolveValue ( mixed $node ) : boolean | ||
$node | mixed | Either a Node object or an absolute context node path |
return | boolean | true if value could be resolved successfully, otherwise false. |
protected function resolveValue($node)
{
if (!$node instanceof NodeInterface && !is_string($node)) {
return false;
}
if (is_string($node)) {
$nodeContextPath = $node;
$contentContext = $this->buildContextFromPath($nodeContextPath, true);
if ($contentContext->getWorkspace() === null) {
return false;
}
$nodePath = $this->removeContextFromPath($nodeContextPath);
$node = $contentContext->getNode($nodePath);
if ($node === null) {
return false;
}
} else {
$contentContext = $node->getContext();
}
if (!$node->getNodeType()->isOfType('Neos.Neos:Document')) {
return false;
}
$siteNode = $contentContext->getCurrentSiteNode();
if ($this->onlyMatchSiteNodes() && $node !== $siteNode) {
return false;
}
$routePath = $this->resolveRoutePathForNode($node);
$this->value = $routePath;
return true;
}