AutoPatrol, Bureaucrats, Administrators
683
edits
(Created page with "__NOTOC__ Get value of node's custom attribute. Function returns requested attribute's value on success or NULL if given attribute does not exist. == Syntax == SetCustomAttri...") |
|||
Line 1: | Line 1: | ||
__NOTOC__ | __NOTOC__ | ||
Set value of node's custom attribute. Function returns previous value of requested attribute or NULL if given attribute was not defined before. | |||
== Syntax == | == Syntax == | ||
SetCustomAttribute(node, attributeName, value) | SetCustomAttribute(''node'', ''attributeName'', ''value'') | ||
== Parameters == | == Parameters == | ||
{| class="wikitable" | {| class="wikitable" | ||
|- | |- | ||
| node || [[NXSL: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 [[SG:Security Issues|Security Issues]] for more information). | | ''node'' || [[NXSL: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 [[SG:Security Issues|Security Issues]] for more information). | ||
|- | |- | ||
| attributeName || Custom attribute name. | | ''attributeName'' || Custom attribute name. | ||
|- | |- | ||
| value || New value for custom attribute. | | ''value'' || New value for custom attribute. | ||
|} | |} | ||
Line 21: | Line 21: | ||
== Examples == | == Examples == | ||
SetCustomAttribute($node, "my_attribute", "new value") -> "old value" | SetCustomAttribute($node, "my_attribute", "new value") -> "old value" | ||
SetCustomAttribute($node, "non_existing_attribute", "new value") -> NULL | |||
SetCustomAttribute($node, "non_existing_attribute", "new value") -> NULL |