Skip to content

tartas1995/Symfony-Collection-Automation

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Symfony-Collection-Automation

a small piece of code to automate collectionTypes in symfony

TO-DO

adding additional event-listener to children

How to use

just add following row to your head

<script src="./symfony-collection.js"></script>

it will automatically search for elements with the data-prototype attribute.

<div data-prototype="<input name="collection[__name__]"/ value="__name__">"></div>

Following settings currently exists:

Option Type Default Description
data-index integer 0 set a different start point
data-placeholder string "__name__" what should be replaced by the index
data-buttonId string none search for button with id or creates button with id
data-buttonClasses string none "btn btn-primary", only needed when button gets created
data-buttonInnerHTML string 'add' what is written inside of the autogenerated button
data-prototype string none This is required.
data-addOneByDefault string 'true' 'false' is the other option. adds 1 prototype by default.

About

a small piece of code to automate collectionTypes in symfony

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published