protected buildContextFromRequestPath ( &$requestPath ) : |
||
return | The built content context |
protected function buildContextFromRequestPath(&$requestPath)
{
$workspaceName = 'live';
$dimensionsAndDimensionValues = $this->parseDimensionsAndNodePathFromRequestPath($requestPath);
// This is a workaround as NodePaths::explodeContextPath() (correctly)
// expects a context path to have something before the '@', but the requestPath
// could potentially contain only the context information.
if (strpos($requestPath, '@') === 0) {
$requestPath = '/' . $requestPath;
}
if ($requestPath !== '' && NodePaths::isContextPath($requestPath)) {
try {
$nodePathAndContext = NodePaths::explodeContextPath($requestPath);
$workspaceName = $nodePathAndContext['workspaceName'];
} catch (\InvalidArgumentException $exception) {
}
}
return $this->buildContextFromWorkspaceNameAndDimensions($workspaceName, $dimensionsAndDimensionValues);
}