Detailed Description
NodeUtil provides services for the Node class.
All methods are static.
Definition at line 28 of file NodeUtil.php.
Static Public Member Functions | |
static | getConnections ($type, $otherRole, $otherType, $hierarchyType='all') |
static | getRelationQueryCondition ($node, $otherRole) |
static | getDisplayValue (Node $node, $language=null) |
static | getDisplayValues (Node $node, $language=null) |
static | makeNodeUrlsRelative (Node $node, $baseUrl, $recursive=true) |
static | translateValues (&$nodes, $language=null, $itemDelim=", ") |
static | translateValue (PersistentObject $object, $valueName, $language, $itemDelim=", ") |
static | removeNonDisplayValues (Node $node) |
static | removeNonPkValues (Node $node) |
Static Protected Member Functions | |
static | getConnectionsImpl ($type, $otherRole, $otherType, $hierarchyType, array &$result=[], array $currentPath=[]) |
Member Function Documentation
◆ getConnections()
|
static |
Get the shortest paths that connect a type to another type.
- Parameters
-
$type The type to start from $otherRole The role of the type at the other end (maybe null, if only type shoudl match) $otherType The type at the other end (maybe null, if only role shoudl match) $hierarchyType The hierarchy type that the other type has in relation to this type 'parent', 'child', 'undefined' or 'all' to get all relations (default: 'all')
- Returns
- An array of PathDescription instances
Definition at line 39 of file NodeUtil.php.
◆ getConnectionsImpl()
|
staticprotected |
Get the relations that connect a type to another type.
- Parameters
-
$type The type to start from $otherRole The role of the type at the other end (maybe null, if only type shoudl match) $otherType The type at the other end (maybe null, if only role shoudl match) $hierarchyType The hierarchy type that the other type has in relation to this type 'parent', 'child', 'undefined' or 'all' to get all relations (default: 'all') $result Array of PathDescriptions after execution $currentPath Internal use only
Definition at line 67 of file NodeUtil.php.
◆ getRelationQueryCondition()
|
static |
Get the query condition used to select all related Nodes of a given role.
- Parameters
-
$node The Node to select the relatives for $otherRole The role of the other nodes
- Returns
- The condition string to be used with StringQuery.
Definition at line 117 of file NodeUtil.php.
◆ getDisplayValue()
|
static |
Get the display value for a Node defined by the 'displayValues' property.
If the 'displayValues' property is an array the items will be put together with ' - '. If the 'displayValues' property is empty the function returns an empty string. Example: 'name,text' shows the name of the Node together with the content of the text attribute
- Parameters
-
$node Node instance to display $language The language if values should be localized. Optional, default is Localization::getDefaultLanguage()
- Returns
- String
Definition at line 152 of file NodeUtil.php.
◆ getDisplayValues()
|
static |
Does the same as NodeUtil::getDisplayValue but returns the display values as associative array.
- Parameters
-
$node Node instance to display $language The language if values should be localized. Optional, default is Localization::getDefaultLanguage()
- Returns
- Array of strings
Definition at line 162 of file NodeUtil.php.
◆ makeNodeUrlsRelative()
|
static |
Make all urls matching a given base url in a Node relative.
- Parameters
-
$node Node instance that holds the value $baseUrl The baseUrl to which matching urls will be made relative $recursive Boolean whether to recurse into child Nodes or not (default: true)
Definition at line 202 of file NodeUtil.php.
◆ translateValues()
|
static |
Translate all list values in a list of Nodes.
- Note
- Translation in this case refers to mapping list values from the key to the value and should not be confused with localization, although values maybe localized using the language parameter.
- Parameters
-
$nodes A reference to the array of Node instances $language The language code, if the translated values should be localized. Optional, default is Localizat$objectgetDefaultLanguage() $itemDelim Delimiter string for array values (optional, default: ", ")
Definition at line 249 of file NodeUtil.php.
◆ translateValue()
|
static |
Translate a PersistentObject list value.
- Parameters
-
$object The object whose value to translate $valueName The name of the value to translate $language The language to use $itemDelim Delimiter string for array values (optional, default: ", ")
Definition at line 266 of file NodeUtil.php.
◆ removeNonDisplayValues()
|
static |
Remove all values from a Node that are not a display value.
- Parameters
-
$node The Node instance
Definition at line 278 of file NodeUtil.php.
◆ removeNonPkValues()
|
static |
Remove all values from a Node that are not a primary key value.
- Parameters
-
$node The Node instance
Definition at line 292 of file NodeUtil.php.