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

[4.x] Fixes Antlers Sections not being yieldable in Blade layouts #9614

Conversation

JohnathonKoster
Copy link
Contributor

This PR corrects an issue with Antlers sections not being yieldable in Blade layouts. The render method here https://github.com/statamic/cms/blob/4.x/src/View/View.php#L100 flushes the sections. The changes here put them back before rendering the layout.

After this, the following will now work again:

layout.blade.php

@yield('the_section')

template.antlers.html

{{ section:the_section }}
The section contents.
{{ /section:the_section }}

@jasonvarga
Copy link
Member

This renders escaped html. Did it always do that?

{{ section:the_section }}
<p class="foo">The section contents.</p>
{{ /section:the_section }}

would yield

&lt;p class=&quot;foo&quot;&gt;The section contents.&lt;/p&gt;

@JohnathonKoster
Copy link
Contributor Author

JohnathonKoster commented Feb 29, 2024

bah. you're right. I was trying to avoid the start/stopSection calls and didn't catch the subtle behavior difference when passing in the content directly. I've wrapped them in HtmlString now. Side note: I was having quite a few challenges getting Blade layouts to work within the test suite to add a test for this

@jasonvarga jasonvarga merged commit 3e52430 into statamic:4.x Feb 29, 2024
18 checks passed
@jasonvarga jasonvarga deleted the fix-sections-not-being-yieldable-inside-blade branch February 29, 2024 17:02
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.

None yet

2 participants