- Fixed a part of Block's doc ; more work to be done on that part

- Fixed whitespaces from unprinted block parts
- Reworked a bit the UrlExtension route grabbing part
This commit is contained in:
Dave Mc Nicoll committed 2024-10-16 20:30:27 +00:00
1 parent 5e54407f74
commit 934643214e
3 files changed
+23 -12

No files matched your search

+5 -6
View File
@@ -43,7 +43,7 @@ class BlockToken implements ControlStructure {
end($slotDefinitions)->setDefinition(eval("return $name;"), $definition);
return <<<PHP
<?php \$this->defineSlot($name, function($definition) {}); ?>
<?php \$this->defineSlot($name, function($definition) {}); ?>
PHP;
case "slot":
@@ -65,7 +65,7 @@ class BlockToken implements ControlStructure {
}
return <<<PHP
<?php \$this->printSlot($name, function($definition array \$___using = []) use (\$picea $loops) { extract(\$___using, \EXTR_SKIP); ?>
<?php \$this->printSlot($name, function($definition array \$___using = []) use (\$picea $loops) { extract(\$___using, \EXTR_SKIP); ?>
PHP;
}
else {
@@ -74,7 +74,7 @@ class BlockToken implements ControlStructure {
}
return <<<PHP
<?php (\$___block ?? \$this)->slotIsSet($name) || \$___block->setSlot($name, function($definition array \$___using = []) use (\$picea $loops) { extract(\$___using, \EXTR_SKIP); ?>
<?php (\$___block ?? \$this)->slotIsSet($name) || \$___block->setSlot($name, function($definition array \$___using = []) use (\$picea $loops) { extract(\$___using, \EXTR_SKIP); ?>
PHP;
}
@@ -89,7 +89,7 @@ class BlockToken implements ControlStructure {
}
return <<<PHP
<?php })->call(\$this, $definition array_merge(get_defined_vars(), \$this->using)); ?>
<?php })->call(\$this, $definition array_merge(get_defined_vars(), \$this->using)); ?>
PHP;
}
else {
@@ -184,7 +184,7 @@ class BlockToken implements ControlStructure {
public function printDefinition(string $name) : string
{
if ( ! isset($this->definitions[$name]) ) {
throw new \Exception("Slot definition for `$name` was not found. Have you defined it in your block header ?");
throw new \Exception("Slot definition for `$name` was not found. Have you defined it in your block header using something like '{% define \"$name\", ...\$arguments %}' ?");
}
return $this->definitions[$name];
@@ -194,7 +194,6 @@ class BlockToken implements ControlStructure {
{
$this->rendering = true;
}
};
}