Skip to content

[3.0] [Form] Move templates from FrameworkBundle to Form #6536

Closed
@webmozart

Description

@webmozart

Currently, the adapters for the Templating component reside in the Form component (to be precise, in Symfony\Component\Form\Extension\Templating) but the relevant templates are still located in FrameworkBundle. They should be moved to the Form's Templating extension before 2.2 to decouple Form from FrameworkBundle.

Plan
  • move view files to Form/Resources/views/
  • move FormHelper to Form/Extension/Templating/
  • make TemplateNameParser in FrameworkBundle accept namespaces ([FrameworkBundle] Made TemplateNameParser able to parse templates in the @-notation (#5660) #7818).
  • add "Form" namespace pointing to the Form component in FrameworkBundle
  • replace "FrameworkBundle:Form" and "FrameworkBundle:FormTable" by "Form:DivLayout" and "Form:TableLayout" in TemplateNameParser
  • add TemplateNameGeneratorInterface to Form/Extension/Templating/ (see below)
  • create a TemplateNameGenerator in the Form component that is compatible with TemplateNameParser in the Templating component
  • create a TemplateNameGenerator in FrameworkBundle that is compatible with TemplateNameParser in FrameworkBundle
  • make TemplatingRendererEngine::loadResourceFromTheme use the TemplateNameGenerator
namespace Symfony\Component\Form\Extension\Templating;

interface TemplateNameGeneratorInterface
{
    // e.g. ->generate('FrameworkBundle:Form', 'form_widget_simple')
    // or ->generate('/path/to/Form/Resources/views/Form', 'form_widget_simple')
    public function generate($theme, $block);
}

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