@php use App\Support\Tilda\BlockCatalog; $catalog = \App\Models\Page::query() ->content() ->orderBy('path') ->get(['path', 'name', 'is_published', 'meta_title', 'meta_description']) ->map(fn ($page) => [ 'path' => $page->path, 'name' => $page->name, 'draft' => ! $page->is_published, 'title' => $page->meta_title ?: $page->name, 'description' => (string) ($page->meta_description ?? ''), ]) ->values(); /** @var \App\Models\Block $record */ $record = $this->getRecord(); $page = $record->page; $blocks = []; if ($page) { foreach ($page->blocks as $block) { if ($block->id === $record->id || BlockCatalog::isPopup($block->code) || in_array($block->code, BlockCatalog::TECHNICAL, true)) { continue; } $rec = $block->recId(); if ($rec === null) { continue; } $text = $block->previewText(80); $blocks[] = [ 'href' => '#rec'.$rec, 'name' => $block->name ?: $block->typeLabel(), 'hint' => $text !== '' ? $text : '#rec'.$rec, ]; } } @endphp