You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I was unable to find an elegant solution to this. It's mentioned in the Symfony2 google group as well. If it's possible it should be mentioned in the docs. If it's not possible, let me know and I'll open this as an issue elsewhere.
With a combination of Googling and reading the docs, I've managed get
a form with an embedded 1:M collection up and running, but now I'm
stumped. What I want to do is theme a single field in an _embedded_
form.
I've successfully themed single fields on the parent form, but what I
expected to work on an embedded form isn't panning out.
Say I have a parent form of type Company and a collection of embedded
forms of type Facility which are inserted into the dom via JS using
the collection type's form prototype.
Say I want to customize just the 'name' field in the parent, Company
form, as demonstrated here:
http://symfony.com/doc/current/cookbook/form/form_customization.html#...
If the ID is company_name I create a twig block with a name of
_company_name_widget and it works perfectly.
Now say I want to customize only the address field of each Facility in
the collection. The ID of that field in the prototype is
company_facilities_$$name$$_address, and my JS would replace the $$name
$$ with an index. I've tried creating twig blocks with names with
different combinations of 'companies', 'facilities', 'address' and
underscores to see if any would register and so far no dice.
Theoretically, if it follows the pattern, a twig block name of
_company_facilities_$$name$$_address_widget should work, but twig
isn't a fan of '$' in block names.
So is this possible?
The text was updated successfully, but these errors were encountered:
If so, we will just need to add a note to the docs after this solution is merged in. If there are other pieces missing, please let me know. The form collection cookbook was just heavily updated, but I think there's still some room for details on theming certain items.
I was unable to find an elegant solution to this. It's mentioned in the Symfony2 google group as well. If it's possible it should be mentioned in the docs. If it's not possible, let me know and I'll open this as an issue elsewhere.
http://groups.google.com/group/symfony2/browse_thread/thread/b3686bbfe561842c?pli=1
The text was updated successfully, but these errors were encountered: