Skip to content

Instantly share code, notes, and snippets.

@Cyr69
Created August 26, 2013 14:09
Show Gist options
  • Save Cyr69/6341807 to your computer and use it in GitHub Desktop.
Save Cyr69/6341807 to your computer and use it in GitHub Desktop.
Customize data-prototype attribute for embedded form collection in Symfony2
<!-- Customize data-prototype attribute for embedded form collection in Symfony2 -->
<!-- form.html.twig -->
<div class="parameters" data-prototype="{% filter escape %}{% include 'AcmeApplicationBundle:Application:field-prototype.html.twig' with {'form': form.parameters.get('prototype')} %}{% endfilter %}"></div>
<!-- field-prototype.html.twig -->
<div>
<!-- Customisez le rendu ici -->
<table>
<tr>
<td>
{{ form_label(form.name1) }}
{{ form_errors(form.name1) }}
{{ form_widget(form.name1) }}
</td>
<td>
{{ form_label(form.name2) }}
{{ form_errors(form.name2) }}
{{ form_widget(form.name2) }}
</td>
</tr>
</table>
</div>
@webdevilopers
Copy link

I am trying to render a data-prototype - as provided by the collection field type - escaped, without spaces and in a single row. Unfortunately the result looks different:
https://gist.github.com/webdevilopers/a0b551771aa634b97a57#file-data-prototype-html

Did you solve this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment