- Fixed ViewToken and BlockToken inline vars

This commit is contained in:
Dave Mc Nicoll committed 2020-11-27 11:32:01 -05:00
1 parent 082bdd4ad3
commit 82eca2e520
7 files changed
+37 -39

No files matched your search

+13 -5
View File
@@ -55,13 +55,21 @@ class BlockToken implements ControlStructure {
$definition = $def->printDefinition($slotName);
if ($definition) {
$definition .= ",";
}
return <<<PHP
<?php \$this->printSlot($name, function($definition, array \$___using = []) { extract(\$___using, \EXTR_SKIP); ?>
<?php \$this->printSlot($name, function($definition array \$___using = []) use (\$picea) { extract(\$___using, \EXTR_SKIP); ?>
PHP;
}
else {
if ($definition) {
$definition .= ",";
}
return <<<PHP
<?php \$___block->slotIsSet($name) || \$___block->setSlot($name, function($definition, array \$___using = []) { extract(\$___using, \EXTR_SKIP); ?>
<?php \$___block->slotIsSet($name) || \$___block->setSlot($name, function($definition array \$___using = []) use (\$picea) { extract(\$___using, \EXTR_SKIP); ?>
PHP;
}
@@ -72,11 +80,11 @@ class BlockToken implements ControlStructure {
$definition = $def->getCurrentSlotDefinitionVars();
if ($definition) {
$definition = "$definition,";
$definition .= ",";
}
return <<<PHP
<?php })->call(\$this, $definition \$this->using); ?>
<?php })->call(\$this, $definition array_merge(get_defined_vars(), \$this->using)); ?>
PHP;
}
else {
@@ -207,7 +215,7 @@ class BlockToken implements ControlStructure {
{
$this->rendering = true;
return $classTemplate->picea->inlineHtml($this, $this->viewPath, ...$this->arguments);
return $classTemplate->picea->inlineBlock($this, $this->viewPath, ...$this->arguments);
}
public function setSlot(string $name, Callable $method) : void