1

I am not sure, how to implement quite simple text field, into the configured form template. I have configured individual fields at yml file.

But what if I want, in the middle of the form, some text formatted informations (fetching data from another entities).

I have learned how to make custom edit template for the entities, by overriding "app/Resources/views/easy_admin/Entity/edit.html.twig".

But it allows me to change the template only around the form fields. The actual form is rendered by "{{ form(form) }}".

So, I need to edit this form() creation or customize the template somehow.

Is the only solution for this custom text field, to create custom form field type in Symfony? Or are there other methods to achieve this?

František Heča
  • 386
  • 3
  • 16
  • Do you want some more input fields from another entity? or just want to show information from other entity in edit form? – Maya Shah Mar 02 '17 at 06:14
  • I wanted "any information I want in the middle of the EasyAdmin form". Even something like "simple text like this to be put in the middle of the form". To do this and not to override the whole EasyAdmin form creation by my own, I had to define new NewFormType and use new_form_widget templating. Then, I can put this field in the EasyAdmin config file. – František Heča Mar 02 '17 at 08:22
  • For simple text you can use Section or help or group option. Check this link https://github.com/javiereguiluz/EasyAdminBundle/blob/master/Resources/doc/book/4-edit-new-configuration.md – Maya Shah Mar 21 '17 at 12:43

1 Answers1

1

hope this helps

in the .twig file:

{% for name in value %}
    <li>
        <span>{{ include('@EasyAdmin/default/edit.html.twig', { value: name.name }) }}</span>
    </li>
{% endfor %}

it means that the variable $name (collection) entered from the entity should be displayed inside this "for loop" you can use the same technique to parse your desired html content

[edit.html.twig is located in app/Resources/views/easy_admin]

Kareem Essawy
  • 565
  • 1
  • 4
  • 14