Files
laravel-manager-packagist/resources/views/components/blocks.blade.php
T
2026-12-04 16:52:00 +00:00

15 lines
821 B
PHP

@props(['page' => null, 'blocks' => null])
{{--
The blocks of a page, drawn with the views of the types. `<x-manager::blocks page="home" />` reads the page; `:blocks="$blocks"` takes
what `Blocks::for()` gave. A view of the site (resources/views/blocks/<type>.blade.php) wins over the package's, a type without a view draws nothing.
--}}
@php
$list = $blocks ?? ($page !== null ? \IriksIT\Manager\Support\Blocks::for((string) $page) : []);
@endphp
@foreach ($list as $block)
@php($view = \IriksIT\Manager\Support\Blocks::view((string) $block['type']))
@if ($view !== null)
@include($view, ['block' => $block, 'data' => $block['data'], 'style' => $block['style'], 'items' => $block['items'] ?? [], 'classes' => \IriksIT\Manager\Support\Blocks::classes($block['style'])])
@endif
@endforeach