The modify
action allows to manipulate your values, correct type issues by correcting them with using available formatters or modifiers from the Encoder.
This action manipulates values. Most modifiers expect only string values.
Check the encoder for more modifiers|formatters.
Here’s some examples of how you might use the modify
action in a YAML file:
actions:
replace_description_characters:
action: modify
modifier: replace_char
keys: 'description,short_description'
characters: ['á' => 'a', 'é' => 'e']
This action will replace the matching characters in a value.
The characters
option is part of the replace_char
modifier.
actions:
replace_active_boolean:
action: modify
formatter: boolean
keys: 'active'
'true':'Y'
'false': 'N'
This action will replace the matching boolean value with a corresponding string value.
In the case of true:Y
, false:N
. If you don’t present a true or false label the default values are true:'1'
, false:'0'
.
The true
or false
option is part of the boolean
formatter.