{{-- Array input: Side list + detail (no tabs), tree view, meta editing --}} @php $safePath = preg_replace('/[^A-Za-z0-9_-]+/', '_', $path); $isFooterSections = $inputName === 'footer_sections'; $isSectionLinks = $inputName === 'section_links'; $addLabel = $isFooterSections ? __('Bölüm Ekle') : ($isSectionLinks ? __('Link Ekle') : __('common.add_item')); $removeLabel = $isFooterSections ? __('Bölüm Sil') : ($isSectionLinks ? __('Link Sil') : __('common.remove_item')); $emptyLabelText = '(Başlık girilmemiş)'; // Sağ panelde gösterilecek detay path'i (bu seviye veya alt seviye) $detailPath = method_exists($this, 'getDetail') ? $this->getDetail($path) : $path; // Sol listedeki bu seviye için mevcut veri ve şema $rawData = data_get($data, $path, []); if (!is_array($rawData)) { $rawData = []; } // Meta (string key) değerleri (örn. 'title') liste sayımına dahil edilmemeli. $actualData = array_values(array_filter($rawData, function ($v, $k) { return is_int($k); }, ARRAY_FILTER_USE_BOTH)); $schemaItems = (isset($inputType['items']) && is_array($inputType['items'])) ? $inputType['items'] : []; $count = max(count($schemaItems), count($actualData)); // Aktif index $activeIndex = method_exists($this, 'getActive') ? $this->getActive($path) : (isset($active[$path]) ? (int)$active[$path] : 0); if ($activeIndex < 0) { $activeIndex=0; } if ($activeIndex>= $count && $count > 0) { $activeIndex = $count - 1; } @endphp

{{ ucfirst(str_replace('_',' ', $inputName)) }} {{ $count }} @if($level > 0) Seviye {{ $level + 1 }} @endif

@php $listClass = $level === 0 ? 'array-items-list' : 'nested-array-list'; @endphp
    @for($k = 0; $k < $count; $k++) @php $schemaForItem=is_array($schemaItems[$k] ?? null) ? $schemaItems[$k] : (is_array($schemaItems[0] ?? null) ? $schemaItems[0] : []); $uid=is_array($schemaForItem) && !empty($schemaForItem['__uid'] ?? null) ? $schemaForItem['__uid'] : ($safePath . '_' . $k); $itemData=$actualData[$k] ?? []; // Etiket üretimi: title/name/label/section_title/heading ve bir seviye içteki string alanlar $candidates=['title','name','section_title','heading','label','ek_bilgiler_left_title','ek_bilgiler_right_title']; if (is_array($schemaForItem)) { foreach ($schemaForItem as $jk=> $jdef) { if ($jk === '__uid') continue; if (!is_array($jdef)) { if (stripos($jk,'title') !== false || stripos($jk,'name') !== false || stripos($jk,'label') !== false) { $candidates[] = $jk; } } } } $label = null; $isEmptyLabel = false; foreach ($candidates as $cand) { if (isset($itemData[$cand]) && is_string($itemData[$cand]) && trim($itemData[$cand]) !== '') { $label = trim((string)$itemData[$cand]); break; } } if ($label === null && is_array($itemData)) { foreach ($itemData as $sv) { if (is_string($sv) && trim($sv) !== '') { $label = \Illuminate\Support\Str::limit(trim($sv), 80); break; } if (is_array($sv)) { foreach ($sv as $ssk => $ssv) { if (is_string($ssv) && trim($ssv) !== '') { $label = \Illuminate\Support\Str::limit(trim($ssv), 80); break 2; } } } } } if ($label === null) { $label = $emptyLabelText; $isEmptyLabel = true; } $isActive = ($k === $activeIndex); @endphp
  • @php $nestedKeysForLi = []; if (is_array($schemaForItem)) { foreach ($schemaForItem as $jk => $jdef) { if ($jk === '__uid') continue; if (is_array($jdef) && (($jdef['type'] ?? null) === 'array')) { $nestedKeysForLi[] = $jk; } } } // 2. seviye için hedef path: şemadan teyit edilmiş ilk child array (list-unstyled nested-array-list) $firstChildKey = null; if (method_exists($this,'getConfigArrayDefinition')) { $itemDef__ = $this->getConfigArrayDefinition($path . '.' . $k); if (is_array($itemDef__)) { foreach ($itemDef__ as $ik__ => $iv__) { if ($ik__ === '__uid') continue; if (is_array($iv__) && (($iv__['type'] ?? null) === 'array')) { $firstChildKey = $ik__; break; } } } } $targetChildPath = $firstChildKey ? ($path . '.' . $k . '.' . $firstChildKey) : null; // Eğer bu child array item'ları da bir 3. seviye array taşıyorsa, top-level "+" bir 2. seviye container eklemek yerine // doğrudan 3. seviye item eklemeli (ek_bilgiler gibi: grup adı -> item1, item2...). $targetChildHasThirdLevel = false; if ($targetChildPath && method_exists($this,'getConfigArrayDefinition')) { $childItemDef__ = $this->getConfigArrayDefinition($targetChildPath . '.0'); if (is_array($childItemDef__)) { foreach ($childItemDef__ as $ck__ => $cv__) { if ($ck__ === '__uid') continue; if (is_array($cv__) && (($cv__['type'] ?? null) === 'array')) { $targetChildHasThirdLevel = true; break; } } } } @endphp
    @if(!empty($targetChildPath)) @endif
    @if(!empty($nestedKeysForLi))
    @foreach($nestedKeysForLi as $nk) @php $childSchema = $schemaForItem[$nk] ?? []; $childItemsSchema = is_array($childSchema) ? ($childSchema['items'] ?? []) : []; $childDataPath = $path . '.' . $k . '.' . $nk; $childSafe = preg_replace('/[^A-Za-z0-9_-]+/', '_', $childDataPath); $childRaw = data_get($data, $childDataPath, []); if (!is_array($childRaw)) { $childRaw = []; } $childData = array_values(array_filter($childRaw, function ($v, $k) { return is_int($k); }, ARRAY_FILTER_USE_BOTH)); $childCount = max(count($childItemsSchema), count($childData)); $childTemplate = is_array($childItemsSchema[0] ?? null) ? $childItemsSchema[0] : []; $childGroupTitleOnce = data_get($data, $childDataPath . '.title'); @endphp
      @for($nkIndex = 0; $nkIndex < $childCount; $nkIndex++) @php $childUid=is_array($childItemsSchema[$nkIndex] ?? null) ? ($childItemsSchema[$nkIndex]['__uid'] ?? ($childSafe . '_' . $nkIndex)) : ($childSafe . '_' . $nkIndex); // Etiket önceden hesapla ve boş başlık ise hiç göstermeyelim $childLabelFor=function ($idx) use ($childData, $childTemplate, $emptyLabelText) { $it=$childData[$idx] ?? []; if (!is_array($it)) $it=[]; $cands=['title','name','section_title','heading','label']; if (is_array($childTemplate)) { foreach ($childTemplate as $kk=> $vv) { if ($kk==='__uid') continue; if (!is_array($vv) && (stripos($kk,'title')!==false || stripos($kk,'name')!==false || stripos($kk,'label')!==false)) { $cands[]=$kk; } } } if (empty(array_intersect($cands, array_keys($it)))) { foreach ($it as $sv) { if (!is_array($sv)) continue; foreach (['title','name','label','section_title','heading'] as $nc) { if (isset($sv[$nc]) && is_string($sv[$nc]) && trim($sv[$nc]) !== '') { return trim((string)$sv[$nc]); } } } } foreach ($cands as $cand) { if (!empty($it[$cand]) && is_string($it[$cand])) { return trim((string)$it[$cand]); } } foreach (['image','file','url'] as $cand) { if (!empty($it[$cand]) && is_string($it[$cand])) { return basename((string)$it[$cand]); } } foreach ($it as $v) { if (is_string($v) && trim($v)!=='') return \Illuminate\Support\Str::limit(trim($v), 80); } return $emptyLabelText; }; $childLabel = $childLabelFor($nkIndex); $childIsActive = ($detailPath === $childDataPath) && (((method_exists($this,'getActive') ? $this->getActive($childDataPath) : 0)) === $nkIndex); // Eğer child item sadece 3. seviye array container'ı ise ve başlık alanı yoksa, header satırını gizle (grup adı -> item1,item2...) $childHasOnlyArrays = true; if (is_array($childTemplate)) { foreach ($childTemplate as $ctk => $ctv) { if ($ctk === '__uid') continue; if (!(is_array($ctv) && (($ctv['type'] ?? null) === 'array'))) { $childHasOnlyArrays = false; break; } } } $hideChildHeader = $childHasOnlyArrays; @endphp
    • @if(!$hideChildHeader)
      @endif @php // 3. seviye $grandNestedKeys = []; if (is_array($childTemplate)) { foreach ($childTemplate as $gjk => $gjdef) { if ($gjk === '__uid') continue; if (is_array($gjdef) && (($gjdef['type'] ?? null) === 'array')) { $grandNestedKeys[] = $gjk; } } } @endphp @if(!empty($grandNestedKeys))
      @foreach($grandNestedKeys as $gnk) @php $grandSchema = $childTemplate[$gnk] ?? []; $grandItemsSchema = is_array($grandSchema) ? ($grandSchema['items'] ?? []) : []; $grandDataPath = $childDataPath . '.' . $nkIndex . '.' . $gnk; $grandRaw = data_get($data, $grandDataPath, []); if (!is_array($grandRaw)) { $grandRaw = []; } $grandData = array_values(array_filter($grandRaw, function ($v, $k) { return is_int($k); }, ARRAY_FILTER_USE_BOTH)); // 3. seviye listelerde placeholder yerine sadece gerçek data sayısını göster $grandCount = count($grandData); @endphp
        @for($gIndex = 0; $gIndex < $grandCount; $gIndex++) @php $grandUid=is_array($grandItemsSchema[$gIndex] ?? null) ? ($grandItemsSchema[$gIndex]['__uid'] ?? (str_replace('.', '_' , $grandDataPath) . '_' . $gIndex)) : (str_replace('.', '_' , $grandDataPath) . '_' . $gIndex); @endphp @php $grandLabelFor=function ($idx) use ($grandData, $grandItemsSchema, $emptyLabelText) { $it=$grandData[$idx] ?? []; if (!is_array($it)) $it=[]; $cands=['title','name','section_title','heading','label']; $t=is_array($grandItemsSchema[0] ?? null) ? $grandItemsSchema[0] : []; if (is_array($t)) { foreach ($t as $kk=> $vv) { if ($kk==='__uid') continue; if (!is_array($vv) && (stripos($kk,'title')!==false || stripos($kk,'name')!==false || stripos($kk,'label')!==false)) { $cands[]=$kk; } } } foreach ($it as $sv) { if (!is_array($sv)) continue; foreach (['title','name','label','section_title','heading'] as $nc) { if (isset($sv[$nc]) && is_string($sv[$nc]) && trim($sv[$nc]) !== '') { return trim((string)$sv[$nc]); } } } foreach ($cands as $cand) { if (!empty($it[$cand]) && is_string($it[$cand])) { return trim((string)$it[$cand]); } } foreach (['image','file','url'] as $cand) { if (!empty($it[$cand]) && is_string($it[$cand])) { return basename((string)$it[$cand]); } } foreach ($it as $v) { if (is_string($v) && trim($v)!=='') return \Illuminate\Support\Str::limit(trim($v), 80); } return $emptyLabelText; }; $grandLabel = $grandLabelFor($gIndex); $grandIsActive = ($detailPath === $grandDataPath) && (((method_exists($this,'getActive') ? $this->getActive($grandDataPath) : 0)) === $gIndex); @endphp
      • @if($grandLabel === $emptyLabelText) {{ $emptyLabelText }} @else {{ $grandLabel }} @endif
      • @endfor
      @endforeach
      @endif
    • @endfor
    @endforeach
    @endif
  • @endfor
Sürükle-bırak ile sıralayabilirsiniz.
@if($count === 0)
Henüz öğe yok. "{{ $addLabel }}" ile başlayın.
@else @php // Detay paneli için şema (bu seviye veya odaklanmış alt seviye) $detailDef = method_exists($this, 'getConfigArrayDefinition') ? $this->getConfigArrayDefinition($detailPath) : null; $detailItems = (is_array($detailDef) && (($detailDef['type'] ?? null) === 'array')) ? ($detailDef['items'] ?? []) : []; if (empty($detailItems)) { $detailItems = $schemaItems; } $detailActiveIndex = method_exists($this, 'getActive') ? $this->getActive($detailPath) : 0; $currentItemSchema = is_array($detailItems[$detailActiveIndex] ?? null) ? $detailItems[$detailActiveIndex] : (is_array($detailItems[0] ?? null) ? $detailItems[0] : []); // Sağ panelde sadece basit alanlar $allKeys = is_array($currentItemSchema) ? array_keys($currentItemSchema) : []; $simpleKeys = []; foreach ($allKeys as $jk) { if ($jk === '__uid') { continue; } $def = $currentItemSchema[$jk] ?? null; if (!(is_array($def) && (($def['type'] ?? null) === 'array'))) { $simpleKeys[] = $jk; } } $detailUid = is_array($currentItemSchema) && !empty($currentItemSchema['__uid'] ?? null) ? $currentItemSchema['__uid'] : ($safePath . '_detail_' . $detailActiveIndex); // Başlık $detailRawArr = data_get($data, $detailPath, []); if (!is_array($detailRawArr)) { $detailRawArr = []; } $detailDataArr = array_values(array_filter($detailRawArr, function ($v, $k) { return is_int($k); }, ARRAY_FILTER_USE_BOTH)); $detailItemData = $detailDataArr[$detailActiveIndex] ?? []; $titleCandidates = ['title','name','section_title','heading','label','ek_bilgiler_left_title','ek_bilgiler_right_title']; if (is_array($currentItemSchema)) { foreach ($currentItemSchema as $dk => $dv) { if ($dk==='__uid') continue; if (!is_array($dv) && (stripos($dk,'title')!==false || stripos($dk,'name')!==false || stripos($dk,'label')!==false)) { $titleCandidates[]=$dk; } } } $detailTitle = null; foreach ($titleCandidates as $cand) { if (isset($detailItemData[$cand]) && is_string($detailItemData[$cand]) && trim($detailItemData[$cand]) !== '') { $detailTitle = trim((string)$detailItemData[$cand]); break; } } if ($detailTitle === null && is_array($detailItemData)) { foreach ($detailItemData as $vv) { if (is_string($vv) && trim($vv) !== '') { $detailTitle = \Illuminate\Support\Str::limit(trim($vv), 80); break; } } } if ($detailTitle === null) { $detailTitle = $emptyLabelText; } // Üst grup meta (toggle ile) $parentArrayPath = null; if (is_string($detailPath)) { $parentArrayPath = preg_match('~\.\d+\.[^.]+$~', $detailPath) ? preg_replace('~\.\d+\.[^.]+$~', '', $detailPath) : null; } $parentMetaKeys = []; $parentDef = null; if ($parentArrayPath && $parentArrayPath !== $detailPath && method_exists($this, 'getConfigArrayDefinition')) { $parentDef = $this->getConfigArrayDefinition($parentArrayPath); if (is_array($parentDef)) { foreach ($parentDef as $pmk => $pmv) { if (in_array($pmk, ['type','items'], true)) continue; if (is_array($pmv) && (($pmv['type'] ?? null) === 'array')) continue; if (is_string($pmv) || (is_array($pmv) && !isset($pmv['type'])) || (is_array($pmv) && isset($pmv['type']) && $pmv['type'] !== 'array')) { $parentMetaKeys[] = $pmk; } } } } @endphp
@php // Ürün grubu başlığı: top-seviyede varsa child array title'ını başlık olarak göster $groupHeaderTitle = null; if ($detailPath === $path && is_array($currentItemSchema)) { $preferred = ['ek_bilgiler_urun_grubu']; $childArrays = []; foreach ($currentItemSchema as $hck => $hcv) { if (is_array($hcv) && (($hcv['type'] ?? null) === 'array')) { $childArrays[] = $hck; } } $order = array_unique(array_merge($preferred, $childArrays)); foreach ($order as $ckey) { $t = data_get($data, $detailPath . '.' . $detailActiveIndex . '.' . $ckey . '.title'); if (is_string($t) && trim($t) !== '') { $groupHeaderTitle = trim($t) . ' üst'; break; } } } @endphp @if($groupHeaderTitle) {{ $groupHeaderTitle }} @else @php $isDetailEmpty = ($detailTitle === $emptyLabelText); @endphp @if($isDetailEmpty) {{ $detailTitle }} @else {{ $detailTitle }} @endif #{{ $detailActiveIndex + 1 }} @endif
{{-- Üst Grup bölümü kaldırıldı --}} @php // Bu dizinin (detailPath) meta alanları $groupMetaKeys = []; if (is_array($detailDef)) { foreach ($detailDef as $mk => $mv) { if (in_array($mk, ['type','items'], true)) continue; if (is_array($mv) && (($mv['type'] ?? null) === 'array')) continue; if (is_string($mv) || (is_array($mv) && !isset($mv['type'])) || (is_array($mv) && isset($mv['type']) && $mv['type'] !== 'array')) { $groupMetaKeys[] = $mk; } } } @endphp @if(!empty($groupMetaKeys))
Meta
@foreach($groupMetaKeys as $metaKey) @php $metaSchema = $detailDef[$metaKey]; $metaPath = $detailPath . '.' . $metaKey; $metaFieldId = str_replace('.', '_', $metaPath); $metaModel = 'data.' . $metaPath; $metaLabel = ucwords(str_replace('_',' ', $metaKey)); $metaType = is_array($metaSchema) ? ($metaSchema['type'] ?? 'string') : (is_string($metaSchema) ? $metaSchema : 'string'); @endphp @switch($metaType) @case('text')
{!! data_get($data, $metaPath, '') !!}
@break @case('string')
@break @case('textarea')
@break @case('number')
@break @case('boolean')
@break @case('select')
@break @case('file')
@break @default
@endswitch @endforeach
@endif @php // Top-levelde (detailPath bu seviye) çocuk array(ler)in başlığını (title) doğrudan düzenleyebilmek için $childArrayKeys = []; if (is_array($currentItemSchema)) { foreach ($currentItemSchema as $ck => $cv) { if (is_array($cv) && (($cv['type'] ?? null) === 'array')) { $childArrayKeys[] = $ck; } } } @endphp @if(!empty($childArrayKeys))
{{ __('common.group_title') }}
@foreach($childArrayKeys as $ck) @php $childDefPath = $detailPath . '.' . $detailActiveIndex . '.' . $ck; $childDef = method_exists($this, 'getConfigArrayDefinition') ? $this->getConfigArrayDefinition($childDefPath) : null; $hasChildTitle = is_array($childDef) && array_key_exists('title', $childDef); $childTitlePath = $childDefPath . '.title'; $childTitleFieldId = str_replace('.', '_', $childTitlePath); $childTitleModel = 'data.' . $childTitlePath; @endphp @if($hasChildTitle)
@endif @endforeach
@endif {{-- Sadece basit alanlar --}} @if(!empty($simpleKeys))
@foreach($simpleKeys as $j) @php $inp = $currentItemSchema[$j]; $currentPath = $detailPath . '.' . $detailActiveIndex . '.' . $j; $fieldId = str_replace('.', '_', $currentPath); $wireModel = 'data.' . $currentPath; @endphp @switch($inp) @case('text')
{!! data_get($data, $currentPath, '') !!}
@break @case('string')
@break @case('number')
@break @case('boolean')
@break @case('select')
@break @case('file')
@if(data_get($data, $currentPath))
preview
@endif
@break @default
@endswitch @endforeach
@endif
@endif