diff --git a/src/Config/Config.php b/src/Config/Config.php
index 43c8fdf..459cb9d 100644
--- a/src/Config/Config.php
+++ b/src/Config/Config.php
@@ -23,11 +23,9 @@ class Config
const SLIDER_DEFAULT_SLIDES_PER_VIEW_TABLET = 2;
- const SLIDER_DEFAULT_SLIDES_PER_VIEW_DESKTOP = 3;
-
const SLIDER_MODES = [
'always' => 'Always show as a slider',
- 'responsive' => 'Slider on mobile/tablet, static grid on desktop',
+ 'responsive' => 'Mobile only',
];
const SLIDER_DEFAULT_MODE = 'always';
diff --git a/src/Controller/CustomHtmlBlockController.php b/src/Controller/CustomHtmlBlockController.php
index f7e8750..c30dc21 100644
--- a/src/Controller/CustomHtmlBlockController.php
+++ b/src/Controller/CustomHtmlBlockController.php
@@ -21,8 +21,11 @@ class CustomHtmlBlockController extends FrameworkBundleAdminController
{
public function indexAction(Request $request, CustomHtmlBlockFilters $filters): Response
{
+ $idGroup = null;
+
if ($request->query->has('idGroup')) {
- $filters->addFilter(['id_ws_customhtml_group' => (int) $request->query->get('idGroup')]);
+ $idGroup = (int) $request->query->get('idGroup');
+ $filters->addFilter(['id_ws_customhtml_group' => $idGroup]);
$filters->setNeedsToBePersisted(false);
}
@@ -31,7 +34,7 @@ class CustomHtmlBlockController extends FrameworkBundleAdminController
return $this->render('@Modules/ws_customhtml/views/templates/admin/grid/customhtmlblock.html.twig', [
'customHtmlBlockGrid' => $this->presentGrid($grid),
- 'layoutHeaderToolbarBtn' => $this->getToolbarButtons($request->get('_legacy_controller')),
+ 'layoutHeaderToolbarBtn' => $this->getToolbarButtons($request->get('_legacy_controller'), $idGroup),
]);
}
@@ -51,9 +54,11 @@ class CustomHtmlBlockController extends FrameworkBundleAdminController
$formHandler = $this->get('websmid.customhtml.form.customhtmlblock_form_handler');
$form = $formBuilder->getForm();
+ $idGroup = $request->query->has('idGroup') ? (int) $request->query->get('idGroup') : null;
+ $redirectParams = null !== $idGroup ? ['idGroup' => $idGroup] : [];
- if ($request->isMethod('GET') && $request->query->has('idGroup')) {
- $form->get('id_ws_customhtml_group')->setData((int) $request->query->get('idGroup'));
+ if ($request->isMethod('GET') && null !== $idGroup) {
+ $form->get('id_ws_customhtml_group')->setData($idGroup);
}
$form->handleRequest($request);
@@ -64,7 +69,7 @@ class CustomHtmlBlockController extends FrameworkBundleAdminController
if (null !== $handlerResult->getIdentifiableObjectId()) {
$this->addFlash('success', $this->trans('Successful creation.', 'Admin.Notifications.Success'));
- return $this->redirectToRoute('customhtmlblock_index');
+ return $this->redirectToRoute('customhtmlblock_index', $redirectParams);
}
} catch (Exception $e) {
$this->addFlash('error', $this->getErrorMessageForException($e, []));
@@ -72,6 +77,7 @@ class CustomHtmlBlockController extends FrameworkBundleAdminController
return $this->render('@Modules/ws_customhtml/views/templates/admin/form/customhtmlblock_create.html.twig', [
'customHtmlBlockForm' => $form->createView(),
+ 'idGroup' => $idGroup,
]);
}
@@ -81,6 +87,8 @@ class CustomHtmlBlockController extends FrameworkBundleAdminController
$formHandler = $this->get('websmid.customhtml.form.customhtmlblock_form_handler');
$form = $formBuilder->getFormFor($idCustomHtmlBlock);
+ $idGroup = $request->query->has('idGroup') ? (int) $request->query->get('idGroup') : null;
+ $redirectParams = null !== $idGroup ? ['idGroup' => $idGroup] : [];
try {
$form->handleRequest($request);
@@ -89,7 +97,7 @@ class CustomHtmlBlockController extends FrameworkBundleAdminController
if ($handlerResult->isSubmitted() && $handlerResult->isValid()) {
$this->addFlash('success', $this->trans('Successful update.', 'Admin.Notifications.Success'));
- return $this->redirectToRoute('customhtmlblock_index');
+ return $this->redirectToRoute('customhtmlblock_index', $redirectParams);
}
} catch (Exception $e) {
$this->addFlash('error', $this->getErrorMessageForException($e, []));
@@ -102,24 +110,28 @@ class CustomHtmlBlockController extends FrameworkBundleAdminController
'customHtmlBlockForm' => $form->createView(),
'idCustomHtmlBlock' => $idCustomHtmlBlock,
'currentImageUrl' => $currentImageUrl,
+ 'idGroup' => $idGroup,
]);
}
public function deleteAction(Request $request, int $idCustomHtmlBlock): RedirectResponse
{
+ $idGroup = $request->query->has('idGroup') ? (int) $request->query->get('idGroup') : null;
+ $redirectParams = null !== $idGroup ? ['idGroup' => $idGroup] : [];
+
$block = new CustomHtmlBlock($idCustomHtmlBlock);
if (!Validate::isLoadedObject($block)) {
$this->addFlash('error', $this->trans('Unable to find the block.', 'Modules.Wscustomhtml.Admin'));
- return $this->redirectToRoute('customhtmlblock_index');
+ return $this->redirectToRoute('customhtmlblock_index', $redirectParams);
}
CustomHtmlFaq::deleteByBlockId($idCustomHtmlBlock);
$block->delete();
$this->addFlash('success', $this->trans('Successful deletion.', 'Admin.Notifications.Success'));
- return $this->redirectToRoute('customhtmlblock_index');
+ return $this->redirectToRoute('customhtmlblock_index', $redirectParams);
}
public function updatePositionAction(int $idGroup, Request $request): RedirectResponse
@@ -144,7 +156,7 @@ class CustomHtmlBlockController extends FrameworkBundleAdminController
return $this->redirectToRoute('customhtmlblock_index', ['idGroup' => $idGroup]);
}
- private function getToolbarButtons(?string $securitySubject): array
+ private function getToolbarButtons(?string $securitySubject, ?int $idGroup = null): array
{
$toolbarButtons = [];
@@ -152,8 +164,10 @@ class CustomHtmlBlockController extends FrameworkBundleAdminController
return $toolbarButtons;
}
+ $routeParams = null !== $idGroup ? ['idGroup' => $idGroup] : [];
+
$toolbarButtons['customhtmlblock_create'] = [
- 'href' => $this->generateUrl('customhtmlblock_create'),
+ 'href' => $this->generateUrl('customhtmlblock_create', $routeParams),
'desc' => $this->trans('New block', 'Admin.Actions'),
'icon' => 'add_circle_outline',
'class' => 'btn-primary',
diff --git a/src/Form/ChoiceProvider/CustomHtmlGroupChoiceProvider.php b/src/Form/ChoiceProvider/CustomHtmlGroupChoiceProvider.php
index 02627ed..1f12272 100644
--- a/src/Form/ChoiceProvider/CustomHtmlGroupChoiceProvider.php
+++ b/src/Form/ChoiceProvider/CustomHtmlGroupChoiceProvider.php
@@ -14,22 +14,9 @@ final class CustomHtmlGroupChoiceProvider implements
{
public function getChoices(array $options = []): array
{
- $groups = Db::getInstance()->executeS(
- 'SELECT `id_ws_customhtml_group`, `title`
- FROM `' . _DB_PREFIX_ . 'ws_customhtml_group`
- ORDER BY `title` ASC'
- );
-
- $titleCounts = array_count_values(array_column($groups, 'title'));
$choices = [];
- foreach ($groups as $group) {
- $label = $group['title'];
-
- if ($titleCounts[$label] > 1) {
- $label .= ' (#' . $group['id_ws_customhtml_group'] . ')';
- }
-
+ foreach ($this->getGroupsWithLabels() as $label => $group) {
$choices[$label] = (int) $group['id_ws_customhtml_group'];
}
@@ -38,6 +25,38 @@ final class CustomHtmlGroupChoiceProvider implements
public function getChoicesAttributes(): array
{
- return [];
+ $choicesAttributes = [];
+
+ foreach ($this->getGroupsWithLabels() as $label => $group) {
+ if (!empty($group['default_block_class'])) {
+ $choicesAttributes[$label]['data-default-block-class'] = $group['default_block_class'];
+ }
+ }
+
+ return $choicesAttributes;
+ }
+
+ private function getGroupsWithLabels(): array
+ {
+ $groups = Db::getInstance()->executeS(
+ 'SELECT `id_ws_customhtml_group`, `title`, `default_block_class`
+ FROM `' . _DB_PREFIX_ . 'ws_customhtml_group`
+ ORDER BY `title` ASC'
+ );
+
+ $titleCounts = array_count_values(array_column($groups, 'title'));
+ $groupsWithLabels = [];
+
+ foreach ($groups as $group) {
+ $label = $group['title'];
+
+ if ($titleCounts[$label] > 1) {
+ $label .= ' (#' . $group['id_ws_customhtml_group'] . ')';
+ }
+
+ $groupsWithLabels[$label] = $group;
+ }
+
+ return $groupsWithLabels;
}
}
diff --git a/src/Form/DataHandler/CustomHtmlBlockDataHandler.php b/src/Form/DataHandler/CustomHtmlBlockDataHandler.php
index f22dece..9fbbcfd 100644
--- a/src/Form/DataHandler/CustomHtmlBlockDataHandler.php
+++ b/src/Form/DataHandler/CustomHtmlBlockDataHandler.php
@@ -34,7 +34,7 @@ final class CustomHtmlBlockDataHandler implements FormDataHandlerInterface
$block->slider_mode = (string) ($formData['slider_mode'] ?? Config::SLIDER_DEFAULT_MODE);
$block->slides_per_view_mobile = (float) ($formData['slides_per_view_mobile'] ?? Config::SLIDER_DEFAULT_SLIDES_PER_VIEW_MOBILE);
$block->slides_per_view_tablet = (float) ($formData['slides_per_view_tablet'] ?? Config::SLIDER_DEFAULT_SLIDES_PER_VIEW_TABLET);
- $block->slides_per_view_desktop = (float) ($formData['slides_per_view_desktop'] ?? Config::SLIDER_DEFAULT_SLIDES_PER_VIEW_DESKTOP);
+ $block->slides_per_view_desktop = (float) ($formData['slides_per_view_desktop'] ?? 0);
$block->autoplay_delay = (int) ($formData['autoplay_delay'] ?? 0);
$block->image = $this->saveUploadedImage($formData['image'] ?? null, '');
$block->active = (int) $formData['active'];
@@ -73,7 +73,7 @@ final class CustomHtmlBlockDataHandler implements FormDataHandlerInterface
$block->slider_mode = (string) ($formData['slider_mode'] ?? Config::SLIDER_DEFAULT_MODE);
$block->slides_per_view_mobile = (float) ($formData['slides_per_view_mobile'] ?? Config::SLIDER_DEFAULT_SLIDES_PER_VIEW_MOBILE);
$block->slides_per_view_tablet = (float) ($formData['slides_per_view_tablet'] ?? Config::SLIDER_DEFAULT_SLIDES_PER_VIEW_TABLET);
- $block->slides_per_view_desktop = (float) ($formData['slides_per_view_desktop'] ?? Config::SLIDER_DEFAULT_SLIDES_PER_VIEW_DESKTOP);
+ $block->slides_per_view_desktop = (float) ($formData['slides_per_view_desktop'] ?? 0);
$block->autoplay_delay = (int) ($formData['autoplay_delay'] ?? 0);
$block->image = $this->saveUploadedImage($formData['image'] ?? null, $block->image);
$block->active = (int) $formData['active'];
diff --git a/src/Form/DataHandler/CustomHtmlGroupDataHandler.php b/src/Form/DataHandler/CustomHtmlGroupDataHandler.php
index a21cd4f..48adb87 100644
--- a/src/Form/DataHandler/CustomHtmlGroupDataHandler.php
+++ b/src/Form/DataHandler/CustomHtmlGroupDataHandler.php
@@ -18,6 +18,7 @@ final class CustomHtmlGroupDataHandler implements FormDataHandlerInterface
$group->title = (string) $formData['title'];
$group->hook_name = (string) $formData['hook_name'];
$group->custom_class = (string) ($formData['custom_class'] ?? '');
+ $group->default_block_class = (string) ($formData['default_block_class'] ?? '');
$group->active = (int) $formData['active'];
$group->ordering = $this->getNextOrdering();
@@ -50,6 +51,7 @@ final class CustomHtmlGroupDataHandler implements FormDataHandlerInterface
$group->title = (string) $formData['title'];
$group->hook_name = (string) $formData['hook_name'];
$group->custom_class = (string) ($formData['custom_class'] ?? '');
+ $group->default_block_class = (string) ($formData['default_block_class'] ?? '');
$group->active = (int) $formData['active'];
if (!$group->update()) {
diff --git a/src/Form/DataProvider/CustomHtmlBlockDataProvider.php b/src/Form/DataProvider/CustomHtmlBlockDataProvider.php
index f9f4141..493c2d1 100644
--- a/src/Form/DataProvider/CustomHtmlBlockDataProvider.php
+++ b/src/Form/DataProvider/CustomHtmlBlockDataProvider.php
@@ -36,7 +36,7 @@ final class CustomHtmlBlockDataProvider implements FormDataProviderInterface
'slider_mode' => $block->slider_mode,
'slides_per_view_mobile' => (float) $block->slides_per_view_mobile,
'slides_per_view_tablet' => (float) $block->slides_per_view_tablet,
- 'slides_per_view_desktop' => (float) $block->slides_per_view_desktop,
+ 'slides_per_view_desktop' => (float) $block->slides_per_view_desktop > 0 ? (float) $block->slides_per_view_desktop : null,
'autoplay_delay' => (int) $block->autoplay_delay,
'faqs' => $this->loadFaqs((int) $id),
'slides' => $this->loadSlides((int) $id),
@@ -63,7 +63,7 @@ final class CustomHtmlBlockDataProvider implements FormDataProviderInterface
'slider_mode' => Config::SLIDER_DEFAULT_MODE,
'slides_per_view_mobile' => Config::SLIDER_DEFAULT_SLIDES_PER_VIEW_MOBILE,
'slides_per_view_tablet' => Config::SLIDER_DEFAULT_SLIDES_PER_VIEW_TABLET,
- 'slides_per_view_desktop' => Config::SLIDER_DEFAULT_SLIDES_PER_VIEW_DESKTOP,
+ 'slides_per_view_desktop' => null,
'autoplay_delay' => 0,
'faqs' => [],
'slides' => [],
diff --git a/src/Form/DataProvider/CustomHtmlGroupDataProvider.php b/src/Form/DataProvider/CustomHtmlGroupDataProvider.php
index 2739ad5..c0eea0f 100644
--- a/src/Form/DataProvider/CustomHtmlGroupDataProvider.php
+++ b/src/Form/DataProvider/CustomHtmlGroupDataProvider.php
@@ -17,20 +17,22 @@ final class CustomHtmlGroupDataProvider implements FormDataProviderInterface
}
return [
- 'title' => $group->title,
- 'hook_name' => $group->hook_name,
- 'custom_class' => $group->custom_class,
- 'active' => (bool) $group->active,
+ 'title' => $group->title,
+ 'hook_name' => $group->hook_name,
+ 'custom_class' => $group->custom_class,
+ 'default_block_class' => $group->default_block_class,
+ 'active' => (bool) $group->active,
];
}
public function getDefaultData()
{
return [
- 'title' => '',
- 'hook_name' => '',
- 'custom_class' => '',
- 'active' => true,
+ 'title' => '',
+ 'hook_name' => '',
+ 'custom_class' => '',
+ 'default_block_class' => '',
+ 'active' => true,
];
}
}
diff --git a/src/Form/Type/CustomHtmlBlockType.php b/src/Form/Type/CustomHtmlBlockType.php
index 754d929..bd657f2 100644
--- a/src/Form/Type/CustomHtmlBlockType.php
+++ b/src/Form/Type/CustomHtmlBlockType.php
@@ -33,9 +33,10 @@ class CustomHtmlBlockType extends AbstractType
{
$formBuilder
->add('id_ws_customhtml_group', ChoiceType::class, [
- 'label' => $this->translator->trans('Group', [], 'Modules.Wscustomhtml.Admin'),
- 'choices' => $this->groupChoiceProvider->getChoices(),
- 'required' => true,
+ 'label' => $this->translator->trans('Group', [], 'Modules.Wscustomhtml.Admin'),
+ 'choices' => $this->groupChoiceProvider->getChoices(),
+ 'choice_attr' => $this->groupChoiceProvider->getChoicesAttributes(),
+ 'required' => true,
])
->add('type', ChoiceType::class, [
'label' => $this->translator->trans('Block type', [], 'Modules.Wscustomhtml.Admin'),
@@ -83,6 +84,7 @@ class CustomHtmlBlockType extends AbstractType
'label' => $this->translator->trans('Slider mode', [], 'Modules.Wscustomhtml.Admin'),
'choices' => array_flip(Config::SLIDER_MODES),
'required' => false,
+ 'help' => $this->translator->trans('"Mobile only": slider only on mobile, a static grid shows instead from tablet up.', [], 'Modules.Wscustomhtml.Admin'),
'row_attr' => ['class' => 'customhtmlblock-type-field customhtmlblock-type-slider'],
])
->add('slides_per_view_mobile', NumberType::class, [
@@ -103,8 +105,8 @@ class CustomHtmlBlockType extends AbstractType
'label' => $this->translator->trans('Slides visible on desktop', [], 'Modules.Wscustomhtml.Admin'),
'required' => false,
'scale' => 2,
- 'attr' => ['min' => 0, 'step' => '0.05'],
- 'help' => $this->translator->trans('In "static grid on desktop" mode this is rounded to the nearest whole number of columns.', [], 'Modules.Wscustomhtml.Admin'),
+ 'attr' => ['min' => 0, 'step' => '0.05', 'placeholder' => $this->translator->trans('Auto', [], 'Modules.Wscustomhtml.Admin')],
+ 'help' => $this->translator->trans('In "Mobile only" mode this is rounded to the nearest whole number of columns. Leave empty for an equal-width column.', [], 'Modules.Wscustomhtml.Admin'),
'row_attr' => ['class' => 'customhtmlblock-type-field customhtmlblock-type-slider col-4'],
])
->add('autoplay_delay', IntegerType::class, [
@@ -130,7 +132,7 @@ class CustomHtmlBlockType extends AbstractType
->add('description', TextareaType::class, [
'label' => $this->translator->trans('Description', [], 'Modules.Wscustomhtml.Admin'),
'required' => false,
- 'row_attr' => ['class' => 'customhtmlblock-type-field customhtmlblock-type-banner customhtmlblock-type-alert'],
+ 'row_attr' => ['class' => 'customhtmlblock-type-field customhtmlblock-type-banner customhtmlblock-type-alert customhtmlblock-type-usp'],
])
->add('extra_description', TextareaType::class, [
'label' => $this->translator->trans('Extra description', [], 'Modules.Wscustomhtml.Admin'),
diff --git a/src/Form/Type/CustomHtmlGroupType.php b/src/Form/Type/CustomHtmlGroupType.php
index 121132c..08ee1a3 100644
--- a/src/Form/Type/CustomHtmlGroupType.php
+++ b/src/Form/Type/CustomHtmlGroupType.php
@@ -29,10 +29,16 @@ class CustomHtmlGroupType extends AbstractType
'required' => true,
])
->add('custom_class', TextType::class, [
- 'label' => $this->translator->trans('Custom classes', [], 'Modules.Wscustomhtml.Admin'),
+ 'label' => $this->translator->trans('Custom group classes', [], 'Modules.Wscustomhtml.Admin'),
'required' => false,
'attr' => ['placeholder' => 'col-md-6'],
])
+ ->add('default_block_class', TextType::class, [
+ 'label' => $this->translator->trans('Default block class', [], 'Modules.Wscustomhtml.Admin'),
+ 'required' => false,
+ 'attr' => ['placeholder' => 'col-12 col-lg-6 col-xl-5'],
+ 'help' => $this->translator->trans('Applied to every block in this group automatically, in addition to that block\'s own custom classes. Useful when several blocks need the same column layout.', [], 'Modules.Wscustomhtml.Admin'),
+ ])
->add('active', SwitchType::class, [
'label' => $this->translator->trans('Active', [], 'Modules.Wscustomhtml.Admin'),
'required' => false,
diff --git a/src/Grid/Definition/Factory/CustomHtmlBlockGridDefinitionFactory.php b/src/Grid/Definition/Factory/CustomHtmlBlockGridDefinitionFactory.php
index 0d0be42..7d01331 100644
--- a/src/Grid/Definition/Factory/CustomHtmlBlockGridDefinitionFactory.php
+++ b/src/Grid/Definition/Factory/CustomHtmlBlockGridDefinitionFactory.php
@@ -170,10 +170,17 @@ final class CustomHtmlBlockGridDefinitionFactory extends AbstractGridDefinitionF
'route_param_field' => 'id_ws_customhtml',
'use_inline_display' => true,
'clickable_row' => true,
+ 'extra_route_params' => ['idGroup' => 'id_ws_customhtml_group'],
])
)
->add(
- $this->buildDeleteAction('customhtmlblock_delete', 'idCustomHtmlBlock', 'id_ws_customhtml')
+ $this->buildDeleteAction(
+ 'customhtmlblock_delete',
+ 'idCustomHtmlBlock',
+ 'id_ws_customhtml',
+ 'POST',
+ ['idGroup' => 'id_ws_customhtml_group']
+ )
);
}
}
diff --git a/src/Grid/Definition/Factory/CustomHtmlGroupGridDefinitionFactory.php b/src/Grid/Definition/Factory/CustomHtmlGroupGridDefinitionFactory.php
index 2e96696..3a47da8 100644
--- a/src/Grid/Definition/Factory/CustomHtmlGroupGridDefinitionFactory.php
+++ b/src/Grid/Definition/Factory/CustomHtmlGroupGridDefinitionFactory.php
@@ -72,11 +72,6 @@ final class CustomHtmlGroupGridDefinitionFactory extends AbstractGridDefinitionF
->setName($this->trans('Hook', [], 'Modules.Wscustomhtml.Admin'))
->setOptions(['field' => 'hook_name'])
)
- ->add(
- (new DataColumn('custom_class'))
- ->setName($this->trans('Custom classes', [], 'Modules.Wscustomhtml.Admin'))
- ->setOptions(['field' => 'custom_class'])
- )
->add(
(new DataColumn('blocks_count'))
->setName($this->trans('Blocks', [], 'Modules.Wscustomhtml.Admin'))
diff --git a/src/Model/CustomHtmlGroup.php b/src/Model/CustomHtmlGroup.php
index fd1377a..831d8ed 100644
--- a/src/Model/CustomHtmlGroup.php
+++ b/src/Model/CustomHtmlGroup.php
@@ -19,6 +19,9 @@ class CustomHtmlGroup extends ObjectModel
/** @var string */
public $custom_class = '';
+ /** @var string */
+ public $default_block_class = '';
+
/** @var int */
public $active = 1;
@@ -38,6 +41,7 @@ class CustomHtmlGroup extends ObjectModel
'hook_name' => ['type' => self::TYPE_STRING, 'validate' => 'isGenericName', 'required' => true, 'size' => 64],
'title' => ['type' => self::TYPE_STRING, 'validate' => 'isGenericName', 'required' => true, 'size' => 256],
'custom_class' => ['type' => self::TYPE_STRING, 'validate' => 'isGenericName', 'required' => false, 'size' => 128],
+ 'default_block_class' => ['type' => self::TYPE_STRING, 'validate' => 'isGenericName', 'required' => false, 'size' => 128],
'active' => ['type' => self::TYPE_BOOL, 'validate' => 'isBool'],
'ordering' => ['type' => self::TYPE_INT, 'validate' => 'isInt'],
'date_add' => ['type' => self::TYPE_DATE, 'validate' => 'isDate'],
@@ -48,7 +52,7 @@ class CustomHtmlGroup extends ObjectModel
public static function getActiveByHookName(string $hookName): array
{
$result = Db::getInstance()->executeS(
- 'SELECT `id_ws_customhtml_group`, `title`, `active`, `custom_class`, `ordering`
+ 'SELECT `id_ws_customhtml_group`, `title`, `active`, `custom_class`, `default_block_class`, `ordering`
FROM `' . _DB_PREFIX_ . 'ws_customhtml_group`
WHERE `hook_name` = \'' . pSQL($hookName) . '\'
AND `active` = 1
diff --git a/src/Module/DisplayHooks.php b/src/Module/DisplayHooks.php
index bf5d2b4..0a82a85 100644
--- a/src/Module/DisplayHooks.php
+++ b/src/Module/DisplayHooks.php
@@ -152,8 +152,11 @@ trait DisplayHooks
} else {
$config['breakpoints'] = [
768 => ['slidesPerView' => (float) $block['slides_per_view_tablet']],
- 992 => ['slidesPerView' => (float) $block['slides_per_view_desktop']],
];
+
+ if ((float) $block['slides_per_view_desktop'] > 0) {
+ $config['breakpoints'][992] = ['slidesPerView' => (float) $block['slides_per_view_desktop']];
+ }
}
if ((int) $block['autoplay_delay'] > 0) {
@@ -167,8 +170,12 @@ trait DisplayHooks
return json_encode($config);
}
- private function buildSliderDesktopColumnWidth(array $block): string
+ private function buildSliderDesktopColumnWidth(array $block): ?string
{
+ if ((float) $block['slides_per_view_desktop'] <= 0) {
+ return null;
+ }
+
$columns = max(1, (int) round((float) $block['slides_per_view_desktop']));
return round(100 / $columns, 4) . '%';
diff --git a/src/Module/Install.php b/src/Module/Install.php
index 42bd874..736e8c6 100644
--- a/src/Module/Install.php
+++ b/src/Module/Install.php
@@ -51,6 +51,7 @@ trait Install
`hook_name` VARCHAR(64) NOT NULL,
`title` VARCHAR(256) NOT NULL DEFAULT \'\',
`custom_class` VARCHAR(128) NOT NULL DEFAULT \'\',
+ `default_block_class` VARCHAR(128) NOT NULL DEFAULT \'\',
`active` TINYINT(1) NOT NULL DEFAULT 1,
`ordering` INT(11) NOT NULL DEFAULT 0,
`date_add` DATETIME NOT NULL,
diff --git a/theme-overrides/displayHomeUsps1/banner.tpl b/theme-overrides/displayHomeUsps1/banner.tpl
new file mode 100644
index 0000000..01a5f80
--- /dev/null
+++ b/theme-overrides/displayHomeUsps1/banner.tpl
@@ -0,0 +1,10 @@
+{if !empty($block.link)}{/if}
+
+ {$block.title|escape:'html':'UTF-8'}
+
+ {$block.description|escape:'html':'UTF-8'|nl2br}
+
+ {$block.title|escape:'html':'UTF-8'}
+
+ {$block.description|escape:'html':'UTF-8'|nl2br}
+