Skip to content

Commit

Permalink
bug #6488 Fix entryToStringMethod when form_parent(form).vars.ea_vars…
Browse files Browse the repository at this point in the history
… is empty (Jean-Pascal Devierne)

This PR was merged into the 4.x branch.

Discussion
----------

Fix entryToStringMethod when form_parent(form).vars.ea_vars is empty

See #6489

Commits
-------

a529718 Fix entryToStringMethod when  form_parent(form).vars.ea_vars is empty
  • Loading branch information
javiereguiluz committed Oct 21, 2024
2 parents 3641167 + a529718 commit f9d0d8e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Resources/views/crud/form_theme.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@
{% block collection_entry_row %}
{% set is_array_field = 'EasyCorp\\Bundle\\EasyAdminBundle\\Field\\ArrayField' == form_parent(form).vars.ea_vars.field.fieldFqcn|default(false) %}
{% set is_complex = form_parent(form).vars.ea_vars.field.customOptions.get('entryIsComplex') ?? false %}
{% set to_string_method = form_parent(form).vars.ea_vars.field.customOptions.get('entryToStringMethod') %}
{% set to_string_method = form_parent(form).vars.ea_vars.field.customOptions.get('entryToStringMethod') ?? null %}
{% set allows_deleting_items = form_parent(form).vars.allow_delete|default(false) %}
{% set render_expanded = not form.vars.valid or form_parent(form).vars.ea_vars.field.customOptions.get('renderExpanded')|default(false) %}
{% set delete_item_button %}
Expand All @@ -211,7 +211,7 @@
<h2 class="accordion-header">
<button class="accordion-button {{ render_expanded ? '' : 'collapsed' }}" type="button" data-bs-toggle="collapse" data-bs-target="#{{ id }}-contents">
<i class="fas fw fa-chevron-right form-collection-item-collapse-marker"></i>
{{ value|ea_as_string(to_string_method) }}
{{ to_string_method ? value|ea_as_string(to_string_method) : value|ea_as_string }}
</button>

{% if allows_deleting_items and not disabled %}
Expand Down

0 comments on commit f9d0d8e

Please sign in to comment.