- Added a loop index in AbstractLoop control struct.

This commit is contained in:
Dave Mc Nicoll committed 2025-10-15 14:57:42 +00:00
1 parent e737e82d7e
commit ef95576d74
10 files changed
+73 -36

No files matched your search

+3 -2
View File
@@ -4,7 +4,7 @@ namespace Picea\ControlStructure;
class BlockToken implements ControlStructure {
public array $token = [ "arguments", "block", "endblock", "define", "slot", "endslot", "using" ];
public array $token = [ "arguments", "block", "endblock", "/block", "define", "slot", "endslot", "/slot", "using" ];
public function parse(\Picea\Compiler\Context &$context, ?string $arguments, string $token, array $options = []) : string
{
@@ -20,6 +20,7 @@ class BlockToken implements ControlStructure {
return "<?php \$___block = \Picea\ControlStructure\BlockToken::instanciateBlock($arguments); ?>";
case "/block":
case "endblock":
$depth--;
return "<?php echo \$___block->render(\$___class__template); unset(\$___block); ?>";
@@ -83,6 +84,7 @@ class BlockToken implements ControlStructure {
PHP;
}
case "/slot":
case "endslot":
$def = ( $slotDefinitions[$depth] ?? end($slotDefinitions) );
@@ -106,7 +108,6 @@ class BlockToken implements ControlStructure {
}
}
public function inlineHtml(? object $proxy, string $viewPath, ... $variables) {
return $this->renderHtml($viewPath, [ 'inlineVariables' => $variables ], $proxy);
}