class Utility (View source)

A class holding utility methods

Methods

static string
renderValidNodeName(string $name)

Transforms a text (for example a node title) into a valid node name by removing invalid characters and transliterating special characters if possible.

static string
sortDimensionValueArrayAndReturnDimensionsHash(array $dimensionValues)

Sorts the incoming $dimensionValues array to make sure that before hashing, the ordering is made deterministic.

static string
buildAutoCreatedChildNodeIdentifier(string $childNodeName, string $identifier)

Generate a stable identifier for auto-created child nodes

Details

static string renderValidNodeName(string $name)

Transforms a text (for example a node title) into a valid node name by removing invalid characters and transliterating special characters if possible.

Parameters

string $name

The possibly invalid node name

Return Value

string

A valid node name

static string sortDimensionValueArrayAndReturnDimensionsHash(array $dimensionValues)

Sorts the incoming $dimensionValues array to make sure that before hashing, the ordering is made deterministic.

Then, calculates and returns the dimensionsHash.

This method is public because it is used inside SiteImportService.

Parameters

array $dimensionValues

Map of dimension names to dimension values, which will be ordered alphabetically after this method.

Return Value

string

the calculated DimensionsHash

static string buildAutoCreatedChildNodeIdentifier(string $childNodeName, string $identifier)

Generate a stable identifier for auto-created child nodes

This is needed if multiple node variants are created through "createNode" with different dimension values. If child nodes with the same path and different identifiers exist, bad things can happen.

Parameters

string $childNodeName
string $identifier

Identifier of the node where the child node should be created

Return Value

string

The generated UUID like identifier