LocalizedField transformer¶
Creates a new array entry for each row that contains the source field. This is used, when you have different entries with locales. Which looks like this:
[
'name.de_DE' => 'deNameTest',
'name.en_US' => 'enNameTest',
'description.de_DE' => 'deDescriptionTest',
'description.en_US' => 'enDescriptionTest',
]
The transformer is gonna combine them to the right locale ID. So the loader can save them.
To build the Transformer:
<localized-field to="localizedValues">
<field fromPrefix="name" targetField="name" />
<field fromPrefix="description" targetField="description" />
</localized-field>
Attributes:
to
- name of the field to be created
Inside, you need to create a field tag which declares the values to be combined.
<field fromPrefix="name" targetField="name" />
Which contains:
* fromPrefix
- name of the field to read from. The field starts with the Prefix
* targetField
- name of the field to be created
FromPrefix declares the value name it should look for. Its gonna load the shop locales and go through every Entry.
In this example, fromPrefix="name"
.
Its gonna look for name.de_DE and save it to name (targetField)
At the end the result is gonna look like this:
46 => [
'name' => 'deNameTest',
'description' => 'deDescriptionTest',
],
66 => [
'name' => 'enNameTest',
'description' => 'enDescriptionTest',
],