Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Overriding bundle templates via Twig namespaces is not possible #8929

Closed
emodric opened this issue Nov 2, 2017 · 7 comments
Closed

Overriding bundle templates via Twig namespaces is not possible #8929

emodric opened this issue Nov 2, 2017 · 7 comments
Labels
Potential Bug Potential bugs or bugfixes, that needs to be reproduced.

Comments

@emodric
Copy link
Contributor

emodric commented Nov 2, 2017

Q A
Bug report? yes
Feature request? no
BC Break report? no
RFC? no
Sylius version 1.0.2

In Symfony, it is possible to override any bundle template by using Twig namespaces. Basically, you register an additional path for a namespace equal to the namespace of the bundle you wish to override.

However, it looks like that Sylius\Bundle\ThemeBundle\Templating\TemplateNameParser breaks this functionality as it assumes that for example @SyliusShop Twig namespace always corresponds to SyliusShopBundle bundle. In reality, @SyliusShop namespace can match any file system path as defined by twig.paths config.

@emodric
Copy link
Contributor Author

emodric commented Nov 2, 2017

By the looks of it, since this TemplateNameParser just converts @SyliusShop/template.html.twig notation to bundle notation, which Symfony does by default, this parser can just be removed, right?

@pamil Can you shed some more light on this?

@CoderMaggie CoderMaggie added the DX Issues and PRs aimed at improving Developer eXperience. label Nov 7, 2017
@stale
Copy link

stale bot commented Feb 5, 2018

This issue has been automatically marked as stale because it has not had any recent activity. It will be closed in a week if no further activity occurs. Thank you for your contributions.

@stale stale bot added the Stale Issues and PRs with no recent activity, about to be closed soon. label Feb 5, 2018
@emodric
Copy link
Contributor Author

emodric commented Feb 5, 2018

@pamil Any news on this? Can this be fixed for 1.1?

@stale stale bot removed the Stale Issues and PRs with no recent activity, about to be closed soon. label Feb 5, 2018
@pamil pamil added this to the 1.0 milestone Feb 5, 2018
@pamil pamil added Potential Bug Potential bugs or bugfixes, that needs to be reproduced. and removed DX Issues and PRs aimed at improving Developer eXperience. labels Feb 5, 2018
@pamil
Copy link
Contributor

pamil commented Feb 5, 2018

@emodric sorry to keep you waiting! At the time I've written ThemeBundle I think the paths were not handled like this, so it looks like a bug caused by Twig changes in the meantime. I'd love to spend some time on it, but I'm quite limited on this matter, so I'd really appreciate if you or someone else could help with this issue. I would be happy to answer all the questions, you can also catch me on Slack :)

As for releases, we can fix it for both 1.0.x and 1.1.x branch.

@emodric
Copy link
Contributor Author

emodric commented Feb 6, 2018

From my very limited investigation, I think that just removing Sylius\Bundle\ThemeBundle\Templating\TemplateNameParser altogether might be a way to go, since its functionality is already included in Symfony, by default. However, I don't know enough about Sylius as a whole to say with certainty that removing it would be a valid fix.

If community has anything to add, I'll gladly listen :)

@teohhanhui
Copy link
Contributor

teohhanhui commented Apr 3, 2018

For a possible workaround (basically just disabling SyliusThemeBundle if you're not using it), see #7491 (comment) see #7491 (comment)

@pamil
Copy link
Contributor

pamil commented Oct 11, 2018

#9804 should fix this one.

@pamil pamil closed this as completed Oct 11, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Potential Bug Potential bugs or bugfixes, that needs to be reproduced.
Projects
None yet
Development

No branches or pull requests

4 participants