- Block can now reference a 'this' object from it's {% using [ 'this' => new stdClass() ] %} token

- Fixed a bug with {% use %} which was buggy whenever two uses were declared and one of them had a curly braces notation in it.
This commit is contained in:
Dave Mc Nicoll committed 2024-10-21 18:09:33 +00:00
1 parent 7970679894
commit 35a7bd4cf7
3 files changed
+8 -3

No files matched your search

+6 -1
View File
@@ -227,7 +227,12 @@ class BlockToken implements ControlStructure {
{
$this->rendering = true;
return $classTemplate->picea->inlineBlock($this, $this->viewPath, ...$this->arguments);
if ($this->using['this'] ?? false) {
$thisProxy = $this->using['this'];
unset($this->using['this']);
}
return $classTemplate->picea->inlineBlock($thisProxy ?? $this, $this->viewPath, ...$this->arguments);
}
public function setSlot(string $name, Callable $method) : void