Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Add relation controller as widget type in model form #169
I followed this excellent tutorial : https://vimeo.com/123489421 to create a one to many relation using the relation controller element. It perfectly works.
But I wonder why the builder plugin don't allow to create that kind of relation directly in the UI. It already allow to create a simple relation (dropdown / checkboxes), or even the recordfinder element.
I think it would be too much difficule to add the relation controller to the list, as a new widget type or as a suboption of the recordfinder, basically you just have to fill the model you want to link, the number of records you want to show by default and the buttons you want to display in the toolbar (add|remove|create|etc...)
The builder plugin could easily create a generic partial by default to display the relation controller :
The only things we should do manually (as I know you don't want to touch php code too much) would be to add the relation controller to the $implement variable, and link the config_relation.yaml. A little like the reorder behavior.
What do you think about this ?
@Alex360hd this would be complicated to implement as at some point the user would have to manually edit something. Perhaps if we had an interface for adding the RelationController behavior to a controller (similar to FormController and ListController) then we could then also have a RelationController formwidget control (alias for partial that generates a .htm partial file in the model directory) defined as well that would use the defined relationcontroller information.
+1 to this, it would be great to be able to fill custom text in that "type" column. Cause there are several plugins that add new types (I think about image resizer for example).
The best option would be to be aware of that additions and add the new types to the list, but another great and simpler options is to allow people to fill what they want into that type.
What about a kind of autocomplete field, but with the possibility to add something that is not to the autocomplete database.