ChangePropertyValue
class ChangePropertyValue extends AbstractTransformation (View source)
Change the value of a given property.
This can apply two transformations:
If newValue is set, the value will be set to this, with any occurrences of the currentValuePlaceholder replaced with the current value of the property.
If search and replace are given, that replacement will be done on the value (after applying the newValue if set).
Properties
protected string | $propertyName | ||
protected string | $newValue | ||
protected string | $search | ||
protected string | $replace | ||
protected string | $currentValuePlaceholder | Placeholder for the current property value to be inserted in newValue. |
Methods
If the given node has the property this transformation should work on, this returns true.
Sets the name of the property to change.
New property value to be set.
Search string to replace in current property value.
Replacement for the search string
The value of this option (defaults to "{current}") will be used to include the current property value into the new value.
Details
bool
isTransformable(NodeData $node)
If the given node has the property this transformation should work on, this returns true.
void
setProperty(string $propertyName)
Sets the name of the property to change.
void
setNewValue(string $newValue)
New property value to be set.
The value of the option "currentValuePlaceholder" (defaults to "{current}") will be used to include the current property value into the new value.
void
setSearch(string $search)
Search string to replace in current property value.
void
setReplace(string $replace)
Replacement for the search string
void
setCurrentValuePlaceholder(string $currentValuePlaceholder)
The value of this option (defaults to "{current}") will be used to include the current property value into the new value.