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

Merged
merged 3 commits into from
Feb 29, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions src/View/View.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace Statamic\View;

use Illuminate\Support\HtmlString;
use InvalidArgumentException;
use Statamic\Facades\Cascade;
use Statamic\Support\Arr;
Expand Down Expand Up @@ -101,6 +102,13 @@ public function render(): string
GlobalRuntimeState::$containsLayout = false;
GlobalRuntimeState::$shareVariablesTemplateTrigger = '';

$factory = app('view');

// Put the sections back. The ->render() will have flushed the sections.
Cascade::sections()->each(function ($content, $section) use ($factory) {
$factory->startSection($section, new HtmlString((string) $content));
});

$contents = view($this->layoutViewName(), array_merge($cascade, GlobalRuntimeState::$layoutVariables, [
'template_content' => $contents,
]));
Expand Down
Loading