Core Concepts
Page Builder
Usage
When installing Autoload and publishing all it's assets into your Laravel Application for the first time, you'll
have a several new Blade files, with the main one being resources/views/page.blade.php
that looks
like this:
1@if ($page->content)2 @foreach ($page->content as $content)3 <x-autoload::page-builder :content="$content" :loop="$loop->index" :page="$page"/>4 @endforeach5@endif
For Reusable Blocks, the logic is the same. Autoload has a Reusable Block View Component that reuses the Page Builder Component within the same loop structure.
You are welcome to modify this file, however, you cannot change the file name or it's location. You may wrap this inside another component as well to display any global navigation or footer information.
1<div data-name="{{ $page->name }}">2 <x-autoload::seo :page="$page" />3 4 @if($page->content)5 @foreach ($page->content as $content)6 <x-autoload::page-builder :content="$content" :loop="$loop->index" :page="$page"/>7 @endforeach8 @endif9</div>
Click here learn more about the SEO Component.
View Component
When passing the $content
variable to the Autoload Page Builder View Component, that component will
"decode" that data into parsable attributes to be passed to your other Blade templates. Think of passing a
Content Block's data into the Page Builder Component will resolve all the Content Block's keys and save them as
variables, with their values, so that they can be passed to the Blade template.
The Page Builder Component is also responsible for resolving what Blade template to render based on the
type
datapoint within the Content Block. Autoload uses this type
to find a matching
Blade file under /resources/views/components/page-builder/xxx.blade.php
. If no file is found, no
exception will be thrown. Instead, Autoload renders a special Blade file that will console log
the error in the browser.