Skip to content

[Form] Reduce code duplication between FormHelper and FormExtension #3905

Closed
@webmozart

Description

@webmozart

The duplicated code in FormHelper (FrameworkBundle) and FormExtension (Twig bridge) should be extracted into a common base class Symfony\Component\Form\AbstractRenderer. It's interface should be extracted into a new Symfony\Component\Form\FormRendererInterface (containing the render*() methods of FormExtension).

The engine specific code should be placed in TwigRenderer (Twig bridge) and TemplatingRenderer (FrameworkBundle). FormHelper and FormExtension can then simply create such a renderer object and forward any method calls to the renderer.

@fabpot: Is the Templating component already able to load templates from components? If yes, we should definitely move FormHelper, TemplatingRenderer and the PHP templates to the Form (or Templating) component to make it self-contained (and usable without FrameworkBundle).

@vicb: Can you do this?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions