@php $fieldType = $field['type'] ?? 'text'; $fieldKey = (string) $field['key']; $translatable = ! empty($field['translatable']); $name = $prefix.'['.$fieldKey.']'; $value = $value ?? null; $current = $translatable ? (is_array($value) ? $value : []) : $value; $locales = $locales ?? \App\Support\Shop::activeLanguages(); $categories = $categories ?? collect(); $branches = $branches ?? collect(); $styles = $styles ?? (array) config('pages.styles', []); $fonts = $fonts ?? \App\Models\Font::query()->active()->orderBy('name')->get(); // Dot path used by the "remove image" checkboxes. preg_match_all('/\[([^\]]+)\]/', $name, $matches); $segments = $matches[1]; array_shift($segments); $dotPath = implode('.', $segments); $options = (array) ($field['options'] ?? []); if (! empty($field['style'])) { $options = $styles; } @endphp @if ($fieldType === 'repeater')
{{ __('admin.repeat_rows', ['count' => count((array) $value)]) }}
@foreach ((array) $value as $index => $row) @include('admin.pages.partials.row', [ 'subFields' => (array) ($field['fields'] ?? []), 'row' => is_array($row) ? $row : [], 'prefix' => $name.'['.$index.']', 'locales' => $locales, 'categories' => $categories, 'branches' => $branches, 'styles' => $styles, 'rowIndex' => $index, ]) @endforeach
@elseif ($translatable)
@foreach ($locales as $language) @php($localized = is_array($current) ? ($current[$language->code] ?? '') : '')
{{ strtoupper($language->code) }} @if ($fieldType === 'textarea') @else @endif
@endforeach
@elseif ($fieldType === 'image')
@if (filled((string) $current)) @else @endif
@if (filled((string) $current)) @endif
@elseif ($fieldType === 'textarea')
@elseif ($fieldType === 'select')
@elseif ($fieldType === 'category')
@elseif ($fieldType === 'branch')
@elseif ($fieldType === 'number')
@elseif ($fieldType === 'url')
@elseif ($fieldType === 'font')
@elseif ($fieldType === 'toggle')
@else
@endif