NXSL:GetCustomAttribute
Jump to navigation
Jump to search
Get value of node's custom attribute. Function returns requested attribute's value on success or NULL if given attribute does not exist.
Syntax
GetCustomAttribute(node, attributeName)
Parameters
node | Node object, you can use predefined variable $node to refer to current node. You can also use null as node if trusted nodes check is disabled (see Security Issues for more information). |
attributeName | Custom attribute name. |
Return Value
String value of custom attribute or NULL if attribute is missing.
Notes
If attribute name conforms to NXSL identifier naming conventions, it can be accessed directly as node object attribute. For example “GetCustomAttribute($node, "my_attribute")” can be changed to “$node->my_attribute”
Examples
GetCustomAttribute($node, "my_attribute") -> "my value" GetCustomAttribute($node, "bad_attribute_name") -> NULL