Skip to content

Commit

Permalink
Implement YieldingTemplate::display*Block()
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolas-grekas committed Feb 6, 2024
1 parent 7e1945a commit 082adfe
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/YieldingTemplate.php
Original file line number Diff line number Diff line change
Expand Up @@ -167,12 +167,16 @@ public function renderParentBlock($name, array $context, array $blocks = [])

public function displayBlock($name, array $context, array $blocks = [], $useBlocks = true, Template $templateContext = null)
{
throw new RuntimeError(sprintf('Calling "%s" for block "%s" is not supported as "use_yield" is set to "true".', __METHOD__, $name), -1, $this->getSourceContext());
foreach ($this->yieldBlock($name, $context, $blocks, $useBlocks, $templateContext) as $data) {
echo $data;
}
}

public function displayParentBlock($name, array $context, array $blocks = [])
{
throw new RuntimeError(sprintf('Calling "%s" for block "%s" is not supported as "use_yield" is set to "true".', __METHOD__, $name), -1, $this->getSourceContext());
foreach ($this->yieldParentBlock($name, $context, $blocks) as $data) {
echo $data;
}
}

protected function displayWithErrorHandling(array $context, array $blocks = [])
Expand Down

0 comments on commit 082adfe

Please sign in to comment.