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) |
static | removeNonDisplayValues (Node $node) |
static | removeNonPkValues (Node $node) |
Static Protected Member Functions | |
static | getConnectionsImpl ($type, $otherRole, $otherType, $hierarchyType, array &$result=array(), array $currentPath=array()) |
Member Function Documentation
|
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.
|
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.
|
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.
|
static |
Get the display value for a Node defined by the 'display_value' property.
If the 'display_value' is an array ('|' separated strings) the pieces will be put together with ' - '. If search for 'display_value' gives no result 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 A reference to the Node to display $language The language if values should be localized. Optional, default is Localization::getDefaultLanguage()
- Note
- The display type is configured via the display_type property of a value. It describes how the value should be displayed. The description is of the formortypetype[attributes]
- type: text|image|link
- attributes: a string of attributes used in the HTML definition (e.g. 'height="50"')
- Returns
- The display string
Definition at line 156 of file NodeUtil.php.
|
static |
Does the same as NodeUtil::getDisplayValue but returns the display value as associative array.
- Parameters
-
$node A reference to the Node to display $language The language if values should be localized. Optional, default is Localization::getDefaultLanguage()
- Returns
- The display array
Definition at line 166 of file NodeUtil.php.
|
static |
Make all urls matching a given base url in a Node relative.
- Parameters
-
$node A reference to the Node the 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 207 of file NodeUtil.php.
|
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 Nodes $language The language code, if the translated values should be localized. Optional, default is Localizat$objectgetDefaultLanguage()
Definition at line 253 of file NodeUtil.php.
|
static |
Remove all values from a Node that are not a display value.
- Parameters
-
$node The Node instance
Definition at line 281 of file NodeUtil.php.
|
static |
Remove all values from a Node that are not a primary key value.
- Parameters
-
$node The Node instance
Definition at line 296 of file NodeUtil.php.