Skip to content

Commit

Permalink
Support displaying localized fields in field collections in version v…
Browse files Browse the repository at this point in the history
…iew (#382)

Co-authored-by: Aleksey Ranuk <[email protected]>
  • Loading branch information
BlackbitDevs and lexwm authored Feb 13, 2024
1 parent 6177d98 commit 45762df
Showing 1 changed file with 18 additions and 6 deletions.
24 changes: 18 additions & 6 deletions templates/admin/data_object/data_object/preview_version.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -154,12 +154,24 @@
{% for fkey,fieldItem in fieldItems %}
{% set fieldKeys = fieldDefinitions[fieldItem.getType()].getFieldDefinitions() %}
{% for fieldKey in fieldKeys %}
{% set value = fieldItem.get(fieldKey.getName()) %}
<tr {% if loop.index is odd %}class="odd"{% endif %}>
<td>{{ fieldItem.getType() ~ " - " ~ fieldKey.getTitle()|trans([],'admin') }}</td>
<td>{{ fieldKey.getName() }}</td>
<td>{{ fieldKey.getVersionPreview(value) | raw }}</td>
</tr>
{% if fieldKey is instanceof('\\Pimcore\\Model\\DataObject\\ClassDefinition\\Data\\Localizedfields') %}
{% for language in validLanguages %}
{% for lfd in fieldKey.getFieldDefinitions() %}
<tr {% if loop.index is odd %}class="odd"{% endif %}>
<td>{{ lfd.getTitle()|trans([],'admin') }} ({{ language }})</td>
<td>{{ fieldItem.fieldName }} - {{ lfd.getName() }}/{{ language }}</td>
<td>{{ fieldItem.Localizedfields.getLocalizedValue(lfd.getName(), language) }}</td>
</tr>
{% endfor %}
{% endfor %}
{% else %}
{% set value = fieldItem.get(fieldKey.getName()) %}
<tr {% if loop.index is odd %}class="odd"{% endif %}>
<td>{{ fieldItem.getType() ~ " - " ~ fieldKey.getTitle()|trans([],'admin') }}</td>
<td>{{ fieldKey.getName() }}</td>
<td>{{ fieldKey.getVersionPreview(value) | raw }}</td>
</tr>
{% endif %}
{% endfor %}
{% endfor %}
{% endif %}
Expand Down

0 comments on commit 45762df

Please sign in to comment.