Skip to content

Misleading php templating guide for custom form types #4088

Closed
@pauvos

Description

@pauvos

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

  1. "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.
  2. 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.
  3. 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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    actionableClear and specific issues ready for anyone to take them.buggood first issueIdeal for your first contribution! (some Symfony experience may be required)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions