style updates

This commit is contained in:
Mark Gregory
2026-07-24 14:59:44 +01:00
parent 24ab771cd3
commit dd23205d0b
482 changed files with 7173 additions and 1435 deletions
+10 -4
View File
@@ -1,13 +1,19 @@
<?php
namespace Modules\Builder\Services;
final class BuilderRenderer
{
public function __construct(private BuilderRegistry $registry) {}
public function render(array $document, array $context=[]): string
public function render(array $document, array $context = []): string
{
return collect($document['nodes'] ?? [])->map(function(array $node) use ($context) {
if (($node['kind'] ?? 'component') === 'container') return '<div class="builder-container">'.$this->render($node,$context).'</div>';
return $this->registry->component((string)($node['type'] ?? 'content'))->render($node['properties'] ?? [],$context);
return collect($document['nodes'] ?? [])->map(function (array $node) use ($context) {
if (($node['kind'] ?? 'component') === 'container') {
return '<div class="builder-container">'.$this->render($node, $context).'</div>';
}
return $this->registry->component((string) ($node['type'] ?? 'content'))->render($node['properties'] ?? [], $context);
})->implode("\n");
}
}