Closed
Description
The documentation seems to be partly wrong/incomplete for php templating of custom form types:
http://symfony.com/doc/master/cookbook/form/create_custom_field_type.html#creating-a-template-for-the-field
- "PHP" tab of the widget shows php syntax but the comment in the first line suggests the file should be named gender_widget.html.twig ... which does not make much sense.
- Instead of declaring the new templates in the twig:form:resources section of the config.yml I think it should be framework:templating:form:resources. That's where the FrameworkBundle's templates are registered.
- A hint to extend framework:templating:engines by 'php' could be helpful (although this is not specific to form type templates).
So while the how-to is precise and working for Twig templating, the alternative php examples are somewhat misleading.
Unfortunately I haven't been able to get this working.
If someone maybe can point me in the right direction I'll be happy to supply a corrected version in a pull request.
Still wondering... how does symfony know which template to render for my form type? Only by the name convention _widget.html.php?