Skip to content

Commit

Permalink
hasBlock() fixed template retrieval [Closes #357]
Browse files Browse the repository at this point in the history
  • Loading branch information
dg committed Mar 19, 2024
1 parent 117bf1a commit bac98d0
Showing 1 changed file with 1 addition and 8 deletions.
9 changes: 1 addition & 8 deletions src/Latte/Essential/CoreExtension.php
Expand Up @@ -25,7 +25,6 @@
final class CoreExtension extends Latte\Extension
{
private Latte\Engine $engine;
private Runtime\Template $template;
private Filters $filters;


Expand All @@ -41,12 +40,6 @@ public function beforeCompile(Latte\Engine $engine): void
}


public function beforeRender(Runtime\Template $template): void
{
$this->template = $template;
}


public function getTags(): array
{
return [
Expand Down Expand Up @@ -191,7 +184,7 @@ public function getFunctions(): array
'last' => [$this->filters, 'last'],
'odd' => [$this->filters, 'odd'],
'slice' => [$this->filters, 'slice'],
'hasBlock' => fn(string $name): bool => $this->template->hasBlock($name),
'hasBlock' => fn(Runtime\Template $template, string $name): bool => $template->hasBlock($name),
];
}

Expand Down

0 comments on commit bac98d0

Please sign in to comment.