Skip to content

Instantly share code, notes, and snippets.

@sashabeep
Last active January 19, 2021 22:28
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sashabeep/40cd5a08ac9fe7b9db2d710b7557bf4f to your computer and use it in GitHub Desktop.
Save sashabeep/40cd5a08ac9fe7b9db2d710b7557bf4f to your computer and use it in GitHub Desktop.
Evo 2.0 pagebuilder controller
...
$this->data['pagebuilder'] = $this->evo->runSnippet('PageBuilder', ['renderTo' => 'array'])[0];
...
<?php
return [
'title' => 'Image with text',
'fields' => [
'image' => [
'caption' => 'Image',
'type' => 'image',
],
'richtext' => [
'caption' => 'Text',
'type' => 'richtext',
'default' => '',
'theme' => 'mini',
'options' => [
'height' => '100px',
],
],
],
//pass block id to data
'prepare' => function($options, &$values) {
$values['block_id'] = 'imgtext'; //partial name for inclusion
}
];
@if($block['image'])
<img src="{{ $block['image'] }}">
@endif
{!! $block['richtext'] !!}
@foreach($pagebuilder as $block)
@include('partials.pagebuilder.'.$block['block_id'], $block)
@endforeach
@Dmi3yy
Copy link

Dmi3yy commented Nov 20, 2019

Понял :) обьясню в видео :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment