Skip to content

Commit

Permalink
EmbedField - show list also on detail page (#2)
Browse files Browse the repository at this point in the history
  • Loading branch information
eminjk authored Oct 7, 2024
1 parent ae1234f commit 5bdcc5d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/Field/EmbedField.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public static function new(string $propertyName, ?string $label = null): self
->setTemplateName('crud/field/embed')
->setFormType(EmbedType::class)
->setFormTypeOption('mapped', false)
->onlyWhenUpdating()
->hideWhenCreating()
;
}
}
6 changes: 4 additions & 2 deletions src/Resources/views/crud/field/embed.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@
{# @var field \EasyCorp\Bundle\EasyAdminBundle\Dto\FieldDto #}
{# @var entity \EasyCorp\Bundle\EasyAdminBundle\Dto\EntityDto #}
{% set current_url = ea_url() %}
{% set field = form.vars.ea_vars.field %}
{% set entity = form.vars.ea_vars.entity %}
{% if form is defined %}
{% set field = form.vars.ea_vars.field %}
{% set entity = form.vars.ea_vars.entity %}
{% endif %}
{% set target_entity = field.doctrineMetadata.get('targetEntity') %}
{% set crudControllers = ea.crudControllers %}
{% set target_entity_crud_fqcn = crudControllers.findCrudFqcnByEntityFqcn(target_entity) %}
Expand Down

0 comments on commit 5bdcc5d

Please sign in to comment.