Yellow Flag

This website version is not maintained anymore

Up to date documentation is available in Symfony 3.x website (see the dropdown menu above).

Advanced usage: custom form theme

A button is no more than anything containing collection-up, collection-down, collection-add or collection-remove classes.

So you can customize buttons by creating a form theme for the form type that will be used inside the collection.

There is only 1 limit: if you're customizing the native collection theme, you should put collection elements in a div one level deeper than the collection's root and no more. This is because the plugin uses $('#collection').find('> div'); to find collection's elements. If you feel that the > div selector should be customizable in a plugin option, please open an issue on Github.

In this example, add-at-the-end is set to true, so instead of seeing your add buttons close to each fields, you can see it at the bottom of the form.


This demostration is made of the following files (click to see on GitHub in a new tab):
    -     Controller/AdvancedController.php
    -     Resources/views/Advanced/advanced-theme.html.twig
    -     Resources/views/Advanced/customFormThemeAddBottom.html.twig

Value : a

Value : b

Value : c