Skip to content

[TwigBundle] Template override path isn't Symfony Flex-friendly #24310

@aik099

Description

@aik099
Q A
Bug report? no
Feature request? no
BC Break report? no
RFC? yes
Symfony version 3.3.9

Before Symfony Flex:

  • template path: /app/Resources/views/{PATH/TO/TEMPLATE.html.twig}
  • override template path: app/Resources/{BUNDLE_NAME}/views/{PATH/TO/TEMPLATE.html.twig}

After Symfony Flex:

  • template path: /templates/{PATH/TO/TEMPLATE.html.twig}
  • override template path: /Resources/{BUNDLE_NAME}/views/{PATH/TO/TEMPLATE.html.twig}

As you can see the override template path doesn't match overall path change logic made in Symfony Flex.

Proposing to look for override templates in /templates/override/{BUNDLE_NAME}/views/{PATH/TO/TEMPLATE.html.twig}.

Right now the override folder is hardcoded in https://github.com/symfony/symfony/blob/master/src/Symfony/Bundle/TwigBundle/DependencyInjection/TwigExtension.php#L128-L130

P.S.
Might be a bug, but .../_error/404.html url is looking for override templates in /src/Resources/{BUNDLE_NAME}/views/{PATH/TO/TEMPLATE.html.twig} folder.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions