PHP Class Neos\ContentRepository\Domain\Utility\NodePaths

Mostra file Open project: neos/neos-development-collection Class Usage Examples

Public Methods

Method Description
addNodePathSegment ( string $nodePath, string $nodePathSegment ) : string Appends the given $nodePathSegment to the $nodePath
explodeContextPath ( string $contextPath ) : array Splits the given context path into relevant information, which results in an array with keys: "nodePath", "workspaceName", "dimensions"
generateContextPath ( string $path, string $workspaceName, array $dimensionValues = [] ) : string Returns the given absolute node path appended with additional context information (such as the workspace name and dimensions).
generateRandomNodeName ( ) : string Generates a simple random node name.
getNodeNameFromPath ( string $path ) : string Get the name for a Node based on the given path.
getParentPath ( string $path ) : string Get the parent path of the given Node path.
getPathDepth ( string $path ) : integer Returns the depth of the given Node path.
getRelativePathBetween ( string $parentPath, string $subPath ) : string Get the relative path between the given $parentPath and the given $subPath.
isContextPath ( string $contextPath ) : boolean Determine if the given node path is a context path.
isSubPathOf ( string $path, string $possibleSubPath ) : boolean Does $possibleSubPath begin with $path and so is a subpath or not.
normalizePath ( $path, string $referencePath = null ) : string Normalizes the given node path to a reference path and returns an absolute path.
parseDimensionValueStringToArray ( string $dimensionValueString ) : array
replaceRelativePathElements ( string $path ) : string Replaces relative path segments ("." or ".

Method Details

addNodePathSegment() public static method

Appends the given $nodePathSegment to the $nodePath
public static addNodePathSegment ( string $nodePath, string $nodePathSegment ) : string
$nodePath string Absolute node path
$nodePathSegment string Usually a nodeName but could also be a relative node path.
return string

explodeContextPath() public static method

Splits the given context path into relevant information, which results in an array with keys: "nodePath", "workspaceName", "dimensions"
See also: generateContextPath()
public static explodeContextPath ( string $contextPath ) : array
$contextPath string a context path including workspace and/or dimension information.
return array split information from the context path

generateContextPath() public static method

Returns the given absolute node path appended with additional context information (such as the workspace name and dimensions).
public static generateContextPath ( string $path, string $workspaceName, array $dimensionValues = [] ) : string
$path string absolute node path
$workspaceName string
$dimensionValues array
return string

generateRandomNodeName() public static method

Generates a simple random node name.
public static generateRandomNodeName ( ) : string
return string

getNodeNameFromPath() public static method

Get the name for a Node based on the given path.
public static getNodeNameFromPath ( string $path ) : string
$path string
return string

getParentPath() public static method

Get the parent path of the given Node path.
public static getParentPath ( string $path ) : string
$path string
return string

getPathDepth() public static method

The root node "/" has depth 0, for every segment 1 is added.
public static getPathDepth ( string $path ) : integer
$path string
return integer

getRelativePathBetween() public static method

Example with "/foo" and "/foo/bar/baz" will return "bar/baz".
public static getRelativePathBetween ( string $parentPath, string $subPath ) : string
$parentPath string
$subPath string
return string

isContextPath() public static method

Determine if the given node path is a context path.
public static isContextPath ( string $contextPath ) : boolean
$contextPath string
return boolean

isSubPathOf() public static method

Does $possibleSubPath begin with $path and so is a subpath or not.
public static isSubPathOf ( string $path, string $possibleSubPath ) : boolean
$path string
$possibleSubPath string
return boolean

normalizePath() public static method

You should usually use \Neos\ContentRepository\Domain\Service\NodeService::normalizePath() because functionality could be overloaded, this is here only for low level operations.
See also: Neos\ContentRepository\Domain\Service\NodeService::normalizePath()
public static normalizePath ( $path, string $referencePath = null ) : string
$path
$referencePath string
return string

parseDimensionValueStringToArray() public static method

public static parseDimensionValueStringToArray ( string $dimensionValueString ) : array
$dimensionValueString string
return array

replaceRelativePathElements() public static method

.") in a given path
public static replaceRelativePathElements ( string $path ) : string
$path string absolute node path with relative path elements ("." or "..").
return string