Last active
January 19, 2021 22:28
-
-
Save sashabeep/40cd5a08ac9fe7b9db2d710b7557bf4f to your computer and use it in GitHub Desktop.
Evo 2.0 pagebuilder controller
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
... | |
$this->data['pagebuilder'] = $this->evo->runSnippet('PageBuilder', ['renderTo' => 'array'])[0]; | |
... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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 | |
} | |
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@if($block['image']) | |
<img src="{{ $block['image'] }}"> | |
@endif | |
{!! $block['richtext'] !!} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@foreach($pagebuilder as $block) | |
@include('partials.pagebuilder.'.$block['block_id'], $block) | |
@endforeach |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Никогда не использовал их, потому что не понял, зачем они нужны...