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

[TwigComponent] Fix debug:twig-component command (anonymous vs non-anonymous components) #1321

Open
wants to merge 4 commits into
base: 2.x
Choose a base branch
from

Conversation

rarila
Copy link

@rarila rarila commented Dec 3, 2023

Q A
Bug fix? yes
New feature? no
License MIT

The debug:twig-component command had problems when anonymous and non-anonymous components were in the same directory.

  • Templates are now also taken into account when they have just a .twig extension instead of a .html.twig extension.
  • Templates belonging to non-anonymous components now are not additionally listed as anonymous component.

Parts of #1320 includes some discussion about this bug.

return $componentPath;
foreach ([
'components/'.$componentPath.'.html.twig',
'components/'.$componentPath.'.twig',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That would be a BC break in a BC layer, we cannot do that :/

$template = rtrim($this->directory, '/').'/'.$componentPath.'.html.twig';
if ($loader->exists($template)) {
return $template;
foreach (['.html.twig', '.twig'] as $extension) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I dont think we want to accept anonymous Component with multiple extensions. The idea was to have a 1:1 relation betwee an anonymous template and its name..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants