abstract class NodePaths (View source)

Provides basic logic concerning node paths.

Methods

static string
addNodePathSegment(string $nodePath, string $nodePathSegment)

Appends the given $nodePathSegment to the $nodePath

static string
generateContextPath(string $path, string $workspaceName, array $dimensionValues = [])

Returns the given absolute node path appended with additional context information (such as the workspace name and dimensions).

static array
explodeContextPath(string $contextPath)

Splits the given context path into relevant information, which results in an array with keys: "nodePath", "workspaceName", "dimensions"

static array
parseDimensionValueStringToArray(string $dimensionValueString)

No description

static bool
isContextPath(string $contextPath)

Determine if the given node path is a context path.

static string
getNodeNameFromPath(string $path)

Get the name for a Node based on the given path.

static string
getParentPath(string $path)

Get the parent path of the given Node path.

static bool
isSubPathOf(string $path, string $possibleSubPath)

Does $possibleSubPath begin with $path and so is a subpath or not.

static int
getPathDepth(string $path)

Returns the depth of the given Node path.

static string
replaceRelativePathElements(string $path)

Replaces relative path segments ("." or "..") in a given path

static string
getRelativePathBetween(string $parentPath, string $subPath)

Get the relative path between the given $parentPath and the given $subPath.

static string
generateRandomNodeName()

Generates a simple random node name.

static string
normalizePath($path, string $referencePath = null)

Normalizes the given node path to a reference path and returns an absolute path.

Details

static string addNodePathSegment(string $nodePath, string $nodePathSegment)

Appends the given $nodePathSegment to the $nodePath

Parameters

string $nodePath

Absolute node path

string $nodePathSegment

Usually a nodeName but could also be a relative node path.

Return Value

string

static string generateContextPath(string $path, string $workspaceName, array $dimensionValues = [])

Returns the given absolute node path appended with additional context information (such as the workspace name and dimensions).

Parameters

string $path

absolute node path

string $workspaceName
array $dimensionValues

Return Value

string

static array explodeContextPath(string $contextPath)

Splits the given context path into relevant information, which results in an array with keys: "nodePath", "workspaceName", "dimensions"

Parameters

string $contextPath

a context path including workspace and/or dimension information.

Return Value

array

split information from the context path

See also

generateContextPath()

static array parseDimensionValueStringToArray(string $dimensionValueString)

No description

Parameters

string $dimensionValueString

Return Value

array

static bool isContextPath(string $contextPath)

Determine if the given node path is a context path.

Parameters

string $contextPath

Return Value

bool

static string getNodeNameFromPath(string $path)

Get the name for a Node based on the given path.

Parameters

string $path

Return Value

string

static string getParentPath(string $path)

Get the parent path of the given Node path.

Parameters

string $path

Return Value

string

static bool isSubPathOf(string $path, string $possibleSubPath)

Does $possibleSubPath begin with $path and so is a subpath or not.

Parameters

string $path
string $possibleSubPath

Return Value

bool

static int getPathDepth(string $path)

Returns the depth of the given Node path.

The root node "/" has depth 0, for every segment 1 is added.

Parameters

string $path

Return Value

int

static string replaceRelativePathElements(string $path)

Replaces relative path segments ("." or "..") in a given path

Parameters

string $path

absolute node path with relative path elements ("." or "..").

Return Value

string

static string getRelativePathBetween(string $parentPath, string $subPath)

Get the relative path between the given $parentPath and the given $subPath.

Example with "/foo" and "/foo/bar/baz" will return "bar/baz".

Parameters

string $parentPath
string $subPath

Return Value

string

static string generateRandomNodeName()

Generates a simple random node name.

Return Value

string

static string normalizePath($path, string $referencePath = null)

Normalizes the given node path to a reference path and returns an absolute path.

You should usually use \Neos\ContentRepository\Domain\Service\NodeService::normalizePath() because functionality could be overloaded, this is here only for low level operations.

Parameters

$path
string $referencePath

Return Value

string

See also

NodeService::normalizePath