Skip to content

Commit b69dc05

Browse files
committed
Center cover block content and buttons
1 parent 6bcb3c2 commit b69dc05

File tree

3 files changed

+130
-0
lines changed

3 files changed

+130
-0
lines changed

config/allowed_files.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,7 @@
171171
'views/templates/hook/prettyblocks/prettyblock_card.tpl',
172172
'views/templates/hook/prettyblocks/prettyblock_category_highlight.tpl',
173173
'views/templates/hook/prettyblocks/prettyblock_contact.tpl',
174+
'views/templates/hook/prettyblocks/prettyblock_cover.tpl',
174175
'views/templates/hook/prettyblocks/prettyblock_cta.tpl',
175176
'views/templates/hook/prettyblocks/prettyblock_divider.tpl',
176177
'views/templates/hook/prettyblocks/prettyblock_everblock.tpl',

models/EverblockPrettyBlocks.php

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ public static function getEverPrettyBlocks($context)
6767
$productHighlightTemplate = 'module:' . $module->name . '/views/templates/hook/prettyblocks/prettyblock_product_highlight.tpl';
6868
$progressbarTemplate = 'module:' . $module->name . '/views/templates/hook/prettyblocks/prettyblock_progressbar.tpl';
6969
$cardTemplate = 'module:' . $module->name . '/views/templates/hook/prettyblocks/prettyblock_card.tpl';
70+
$coverTemplate = 'module:' . $module->name . '/views/templates/hook/prettyblocks/prettyblock_cover.tpl';
7071
$defaultLogo = Tools::getHttpHost(true) . __PS_BASE_URI__ . 'modules/' . $module->name . '/logo.png';
7172
$blocks = [];
7273
$allShortcodes = EverblockShortcode::getAllShortcodes(
@@ -2744,6 +2745,91 @@ public static function getEverPrettyBlocks($context)
27442745
],
27452746
],
27462747
];
2748+
$blocks[] = [
2749+
'name' => $module->l('Cover block'),
2750+
'description' => $module->l('Background image with title, text and two buttons'),
2751+
'code' => 'everblock_cover',
2752+
'tab' => 'general',
2753+
'icon_path' => $defaultLogo,
2754+
'need_reload' => true,
2755+
'templates' => [
2756+
'default' => $coverTemplate,
2757+
],
2758+
'repeater' => [
2759+
'name' => 'Cover',
2760+
'nameFrom' => 'title',
2761+
'groups' => [
2762+
'title' => [
2763+
'type' => 'text',
2764+
'label' => $module->l('Title'),
2765+
'default' => '',
2766+
],
2767+
'content' => [
2768+
'type' => 'editor',
2769+
'label' => $module->l('Content'),
2770+
'default' => '',
2771+
],
2772+
'background_image' => [
2773+
'type' => 'fileupload',
2774+
'label' => $module->l('Background image'),
2775+
'path' => '$/modules/' . $module->name . '/views/img/prettyblocks/',
2776+
'default' => [
2777+
'url' => '',
2778+
],
2779+
],
2780+
'btn1_text' => [
2781+
'type' => 'text',
2782+
'label' => $module->l('Button 1 text'),
2783+
'default' => '',
2784+
],
2785+
'btn1_link' => [
2786+
'type' => 'text',
2787+
'label' => $module->l('Button 1 link'),
2788+
'default' => '',
2789+
],
2790+
'btn1_type' => [
2791+
'type' => 'radio_group',
2792+
'label' => $module->l('Button 1 type'),
2793+
'default' => 'primary',
2794+
'choices' => [
2795+
'primary' => 'primary',
2796+
'secondary' => 'secondary',
2797+
'success' => 'success',
2798+
'danger' => 'danger',
2799+
'warning' => 'warning',
2800+
'info' => 'info',
2801+
'light' => 'light',
2802+
'dark' => 'dark',
2803+
],
2804+
],
2805+
'btn2_text' => [
2806+
'type' => 'text',
2807+
'label' => $module->l('Button 2 text'),
2808+
'default' => '',
2809+
],
2810+
'btn2_link' => [
2811+
'type' => 'text',
2812+
'label' => $module->l('Button 2 link'),
2813+
'default' => '',
2814+
],
2815+
'btn2_type' => [
2816+
'type' => 'radio_group',
2817+
'label' => $module->l('Button 2 type'),
2818+
'default' => 'primary',
2819+
'choices' => [
2820+
'primary' => 'primary',
2821+
'secondary' => 'secondary',
2822+
'success' => 'success',
2823+
'danger' => 'danger',
2824+
'warning' => 'warning',
2825+
'info' => 'info',
2826+
'light' => 'light',
2827+
'dark' => 'dark',
2828+
],
2829+
],
2830+
],
2831+
],
2832+
];
27472833
EverblockCache::cacheStore($cacheId, $blocks);
27482834
return $blocks;
27492835
}
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
{*
2+
* 2019-2025 Team Ever
3+
*
4+
* NOTICE OF LICENSE
5+
*
6+
* This source file is subject to the Academic Free License (AFL 3.0)
7+
* that is bundled with this package in the file LICENSE.txt.
8+
* It is also available through the world-wide-web at this URL:
9+
* http://opensource.org/licenses/afl-3.0.php
10+
* If you did not receive a copy of the license and are unable to
11+
* obtain it through the world-wide-web, please send an email
12+
* to [email protected] so we can send you a copy immediately.
13+
*
14+
* @author Team Ever <https://www.team-ever.com/>
15+
* @copyright 2019-2025 Team Ever
16+
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
17+
*}
18+
<div id="block-{$block.id_prettyblocks}" class="prettyblock-cover">
19+
{if isset($block.states) && $block.states}
20+
{foreach from=$block.states item=state key=key}
21+
<div id="block-{$block.id_prettyblocks}-{$key}"
22+
class="prettyblock-cover-item{if $state.css_class} {$state.css_class|escape:'htmlall'}{/if} text-center"
23+
style="{if isset($state.background_image.url) && $state.background_image.url}background-image: url('{$state.background_image.url|escape:'htmlall'}'); background-size: cover; background-position: center;{/if}">
24+
{if $state.title}
25+
<h2>{$state.title|escape:'htmlall'}</h2>
26+
{/if}
27+
{if $state.content}
28+
{$state.content nofilter}
29+
{/if}
30+
{if ($state.btn1_text && $state.btn1_link) || ($state.btn2_text && $state.btn2_link)}
31+
<div class="mt-3 d-flex justify-content-center gap-2">
32+
{if $state.btn1_text && $state.btn1_link}
33+
<a href="{$state.btn1_link|escape:'htmlall'}" class="btn btn-{$state.btn1_type|escape:'htmlall'}">{$state.btn1_text|escape:'htmlall'}</a>
34+
{/if}
35+
{if $state.btn2_text && $state.btn2_link}
36+
<a href="{$state.btn2_link|escape:'htmlall'}" class="btn btn-{$state.btn2_type|escape:'htmlall'}">{$state.btn2_text|escape:'htmlall'}</a>
37+
{/if}
38+
</div>
39+
{/if}
40+
</div>
41+
{/foreach}
42+
{/if}
43+
</div>

0 commit comments

Comments
 (0)