{{-- Renders a section type's settings from its schema(). This is the reason a new kind of section needs no admin blade: declare the fields in the type's schema() and they appear here, validated by the same declaration. Expects: $schema, $values. --}} @forelse($schema as $field => $spec) @php $type = $spec['type'] ?? 'text'; $name = "settings[{$field}]"; $id = "setting_{$field}"; $current = old("settings.{$field}", $values[$field] ?? ($spec['default'] ?? null)); $error = "settings.{$field}"; // Options may be a closure so the query runs only when the form is // rendered — never on the public site. $options = $spec['options'] ?? []; $options = $options instanceof \Closure ? $options() : $options; @endphp
@if($type === 'toggle') @elseif($type === 'select') @elseif($type === 'number') @elseif($type === 'textarea') @else @endif @error($error) {{ $message }} @enderror
@empty

{{ ___('label.section_has_no_settings') }}

@endforelse