{{-- One block in the page editor. Expects $index (a number, or __BLOCK__ inside a template), $type, $data and $mediaPreviews. --}} @php $definition = \App\Services\Content\BlockDefinitions::get($type) ?? ['label' => $type, 'icon' => 'layout-dashboard', 'hint' => '', 'fields' => []]; $data = is_array($data) ? $data : []; $prefix = 'blocks['.$index.'][data]'; @endphp
@include('admin.partials.icon', ['name' => $definition['icon'], 'class' => 'h-4 w-4 text-muted-foreground']) {{ $definition['label'] }}
@foreach ($definition['fields'] as $field) @include('admin.pages.partials.block-field', [ 'field' => $field, 'value' => $data[$field['name']] ?? null, 'prefix' => $prefix, 'mediaPreviews' => $mediaPreviews, ]) @endforeach @if (($definition['hint'] ?? '') !== '')

{{ $definition['hint'] }}

@endif