Neos\ContentRepository\Domain\Utility\NodePaths::addNodePathSegment PHP Method

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
    public static function addNodePathSegment($nodePath, $nodePathSegment)
    {
        $nodePath = rtrim($nodePath, '/');
        if ($nodePathSegment !== '' || $nodePath === '') {
            $nodePath .= '/' . trim($nodePathSegment, '/');
        }
        return $nodePath;
    }

Usage Example

コード例 #1
0
 /**
  * Normalizes the given node path to a reference path and returns an absolute path.
  *
  * @param string $path The non-normalized path
  * @param string $referencePath a reference path in case the given path is relative.
  * @param string $siteNodePath Reference path to a site node. Relative paths starting with "~" will be based on the siteNodePath.
  * @return string The normalized absolute path
  * @throws \InvalidArgumentException if the node path was invalid.
  */
 public function normalizePath($path, $referencePath = null, $siteNodePath = null)
 {
     if (strpos($path, '~') === 0) {
         $path = NodePaths::addNodePathSegment($siteNodePath, substr($path, 1));
     }
     return parent::normalizePath($path, $referencePath);
 }
All Usage Examples Of Neos\ContentRepository\Domain\Utility\NodePaths::addNodePathSegment