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

Slot content is not being inserted into the component #32

Open
bytespider opened this issue Feb 12, 2025 · 2 comments
Open

Slot content is not being inserted into the component #32

bytespider opened this issue Feb 12, 2025 · 2 comments

Comments

@bytespider
Copy link

Versions:
PHP: 7.4.33
Twig: 3.11.3

Reproducing

// component/button.twig
<button {{ attributes.merge({ class: 'text-white' }) }}>{{ slot }}</button>
// page.twig
{% x:button with {class:'bg-blue-600'} %} test {% endx %}

Result

<html>
  <head>
  </head>
  <body>test <button class="bg-blue-600 text-white"></button>
  </body>
</html>

Solution

When I downgrade to Twig 3.0.5 the code above work as expected.

@giorgiopogliani
Copy link
Owner

Do you have problems on php 8.0?

Seems weird because this is a basic example and should be covered in tests, which are all passing.

Test github action doesn’t run php 7.4 because I was going to drop support at some point so I didn’t bother adding it.

@bytespider
Copy link
Author

Unfortunately I cannot upgrade to 8.0 at this time. I'm trying to bring a legacy application up to date.

If you're choosing to stop supporting PHP 7.x then at least downgrading Twig to a lower version helps for others that may encounter this. Getting from Twig 1.x to 3.x was a lot of work.

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

No branches or pull requests

2 participants