Compare commits
8
Commits
be9a676d9d
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e97af7a1da | ||
|
|
150e068550 | ||
|
|
a71ab197ce | ||
|
|
ccd105907a | ||
|
|
4e7333493a | ||
|
|
7cafc376b7 | ||
|
|
85b56f1a13 | ||
|
|
620c34e353 |
+4
-7
@@ -2,8 +2,7 @@ services:
|
||||
websmid.customhtml.form.type.customhtml_group:
|
||||
public: true
|
||||
class: 'Websmid\CustomHtml\Form\Type\CustomHtmlGroupType'
|
||||
arguments:
|
||||
- '@translator'
|
||||
parent: "form.type.translatable.aware"
|
||||
tags:
|
||||
- { name: form.type }
|
||||
|
||||
@@ -37,24 +36,22 @@ services:
|
||||
websmid.customhtml.form.type.customhtml_faq:
|
||||
public: true
|
||||
class: 'Websmid\CustomHtml\Form\Type\CustomHtmlFaqType'
|
||||
arguments:
|
||||
- '@translator'
|
||||
parent: "form.type.translatable.aware"
|
||||
tags:
|
||||
- { name: form.type }
|
||||
|
||||
websmid.customhtml.form.type.customhtml_slide:
|
||||
public: true
|
||||
class: 'Websmid\CustomHtml\Form\Type\CustomHtmlSlideType'
|
||||
arguments:
|
||||
- '@translator'
|
||||
parent: "form.type.translatable.aware"
|
||||
tags:
|
||||
- { name: form.type }
|
||||
|
||||
websmid.customhtml.form.type.customhtml_block:
|
||||
public: true
|
||||
class: 'Websmid\CustomHtml\Form\Type\CustomHtmlBlockType'
|
||||
parent: "form.type.translatable.aware"
|
||||
arguments:
|
||||
- '@translator'
|
||||
- '@websmid.customhtml.form.choice_provider.customhtml_group_choice_provider'
|
||||
tags:
|
||||
- { name: form.type }
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
<?php
|
||||
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
|
||||
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
|
||||
header('Cache-Control: no-store, no-cache, must-revalidate');
|
||||
header('Cache-Control: post-check=0, pre-check=0', false);
|
||||
header('Pragma: no-cache');
|
||||
header('Location: ../');
|
||||
exit;
|
||||
@@ -39,6 +39,12 @@ customhtmlgroup_delete:
|
||||
defaults:
|
||||
_controller: 'Websmid\CustomHtml\Controller\CustomHtmlGroupController::deleteAction'
|
||||
|
||||
customhtmlgroup_toggle:
|
||||
path: ws_customhtml/group/toggle/{idCustomHtmlGroup}
|
||||
methods: [GET, POST]
|
||||
defaults:
|
||||
_controller: 'Websmid\CustomHtml\Controller\CustomHtmlGroupController::toggleAction'
|
||||
|
||||
customhtmlgroup_update_position:
|
||||
path: ws_customhtml/group/update-position
|
||||
methods: [POST]
|
||||
|
||||
@@ -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';
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
<?php
|
||||
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
|
||||
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
|
||||
header('Cache-Control: no-store, no-cache, must-revalidate');
|
||||
header('Cache-Control: post-check=0, pre-check=0', false);
|
||||
header('Pragma: no-cache');
|
||||
header('Location: ../');
|
||||
exit;
|
||||
@@ -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',
|
||||
|
||||
@@ -106,6 +106,27 @@ class CustomHtmlGroupController extends FrameworkBundleAdminController
|
||||
return $this->redirectToRoute('customhtmlgroup_index');
|
||||
}
|
||||
|
||||
public function toggleAction(int $idCustomHtmlGroup): RedirectResponse
|
||||
{
|
||||
$group = new CustomHtmlGroup($idCustomHtmlGroup);
|
||||
|
||||
if (!Validate::isLoadedObject($group)) {
|
||||
$this->addFlash('error', $this->trans('Unable to find the group.', 'Modules.Wscustomhtml.Admin'));
|
||||
|
||||
return $this->redirectToRoute('customhtmlgroup_index');
|
||||
}
|
||||
|
||||
$group->active = (int) !$group->active;
|
||||
|
||||
if (!$group->update()) {
|
||||
$this->addFlash('error', $this->trans('An error occurred while updating the status.', 'Admin.Notifications.Error'));
|
||||
} else {
|
||||
$this->addFlash('success', $this->trans('Successful update.', 'Admin.Notifications.Success'));
|
||||
}
|
||||
|
||||
return $this->redirectToRoute('customhtmlgroup_index');
|
||||
}
|
||||
|
||||
public function updatePositionAction(Request $request): RedirectResponse
|
||||
{
|
||||
$positionDefinition = $this->get('websmid.customhtml.grid.position.customhtmlgroup_position_definition');
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
<?php
|
||||
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
|
||||
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
|
||||
header('Cache-Control: no-store, no-cache, must-revalidate');
|
||||
header('Cache-Control: post-check=0, pre-check=0', false);
|
||||
header('Pragma: no-cache');
|
||||
header('Location: ../');
|
||||
exit;
|
||||
@@ -5,6 +5,7 @@ namespace Websmid\CustomHtml\Form\ChoiceProvider;
|
||||
use PrestaShop\PrestaShop\Core\Form\ConfigurableFormChoiceProviderInterface;
|
||||
use PrestaShop\PrestaShop\Core\Form\FormChoiceAttributeProviderInterface;
|
||||
use PrestaShop\PrestaShop\Core\Form\FormChoiceProviderInterface;
|
||||
use Context;
|
||||
use Db;
|
||||
|
||||
final class CustomHtmlGroupChoiceProvider implements
|
||||
@@ -14,22 +15,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 +26,42 @@ 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
|
||||
{
|
||||
$idLang = (int) Context::getContext()->language->id;
|
||||
|
||||
$groups = Db::getInstance()->executeS(
|
||||
'SELECT g.`id_ws_customhtml_group`, gl.`title`, g.`default_block_class`
|
||||
FROM `' . _DB_PREFIX_ . 'ws_customhtml_group` g
|
||||
LEFT JOIN `' . _DB_PREFIX_ . 'ws_customhtml_group_lang` gl
|
||||
ON gl.`id_ws_customhtml_group` = g.`id_ws_customhtml_group` AND gl.`id_lang` = ' . (int) $idLang . '
|
||||
ORDER BY gl.`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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
<?php
|
||||
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
|
||||
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
|
||||
header('Cache-Control: no-store, no-cache, must-revalidate');
|
||||
header('Cache-Control: post-check=0, pre-check=0', false);
|
||||
header('Pragma: no-cache');
|
||||
header('Location: ../');
|
||||
exit;
|
||||
@@ -20,21 +20,21 @@ final class CustomHtmlBlockDataHandler implements FormDataHandlerInterface
|
||||
|
||||
$block = new CustomHtmlBlock();
|
||||
$block->id_ws_customhtml_group = $idGroup;
|
||||
$block->title = (string) $formData['title'];
|
||||
$block->title = $formData['title'];
|
||||
$block->type = (string) $formData['type'];
|
||||
$block->show_title = (int) $formData['show_title'];
|
||||
$block->custom_class = (string) ($formData['custom_class'] ?? '');
|
||||
$block->content = (string) $formData['content'];
|
||||
$block->description = (string) ($formData['description'] ?? '');
|
||||
$block->extra_description = (string) ($formData['extra_description'] ?? '');
|
||||
$block->link = (string) ($formData['link'] ?? '');
|
||||
$block->link_text = (string) ($formData['link_text'] ?? '');
|
||||
$block->content = $formData['content'];
|
||||
$block->description = $formData['description'] ?? [];
|
||||
$block->extra_description = $formData['extra_description'] ?? [];
|
||||
$block->link = $formData['link'] ?? [];
|
||||
$block->link_text = $formData['link_text'] ?? [];
|
||||
$block->alert_type = (string) ($formData['alert_type'] ?? 'info');
|
||||
$block->timeout = (int) ($formData['timeout'] ?? 0);
|
||||
$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'];
|
||||
@@ -59,21 +59,21 @@ final class CustomHtmlBlockDataHandler implements FormDataHandlerInterface
|
||||
}
|
||||
|
||||
$block->id_ws_customhtml_group = (int) $formData['id_ws_customhtml_group'];
|
||||
$block->title = (string) $formData['title'];
|
||||
$block->title = $formData['title'];
|
||||
$block->type = (string) $formData['type'];
|
||||
$block->show_title = (int) $formData['show_title'];
|
||||
$block->custom_class = (string) ($formData['custom_class'] ?? '');
|
||||
$block->content = (string) $formData['content'];
|
||||
$block->description = (string) ($formData['description'] ?? '');
|
||||
$block->extra_description = (string) ($formData['extra_description'] ?? '');
|
||||
$block->link = (string) ($formData['link'] ?? '');
|
||||
$block->link_text = (string) ($formData['link_text'] ?? '');
|
||||
$block->content = $formData['content'];
|
||||
$block->description = $formData['description'] ?? [];
|
||||
$block->extra_description = $formData['extra_description'] ?? [];
|
||||
$block->link = $formData['link'] ?? [];
|
||||
$block->link_text = $formData['link_text'] ?? [];
|
||||
$block->alert_type = (string) ($formData['alert_type'] ?? 'info');
|
||||
$block->timeout = (int) ($formData['timeout'] ?? 0);
|
||||
$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'];
|
||||
@@ -135,7 +135,7 @@ final class CustomHtmlBlockDataHandler implements FormDataHandlerInterface
|
||||
{
|
||||
$maxOrdering = Db::getInstance()->getValue(
|
||||
'SELECT MAX(`ordering`) FROM `' . _DB_PREFIX_ . 'ws_customhtml`
|
||||
WHERE `id_ws_customhtml_group` = ' . $idGroup
|
||||
WHERE `id_ws_customhtml_group` = ' . (int) $idGroup
|
||||
);
|
||||
|
||||
return $maxOrdering === false || $maxOrdering === null ? 0 : ((int) $maxOrdering + 1);
|
||||
@@ -146,14 +146,18 @@ final class CustomHtmlBlockDataHandler implements FormDataHandlerInterface
|
||||
CustomHtmlFaq::deleteByBlockId($idBlock);
|
||||
|
||||
foreach (array_values($faqs) as $position => $faqData) {
|
||||
if (empty($faqData['question'])) {
|
||||
$question = $faqData['question'] ?? [];
|
||||
|
||||
if (empty(array_filter($question, static function ($value) {
|
||||
return trim((string) $value) !== '';
|
||||
}))) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$faq = new CustomHtmlFaq();
|
||||
$faq->id_ws_customhtml = $idBlock;
|
||||
$faq->question = (string) $faqData['question'];
|
||||
$faq->answer = (string) ($faqData['answer'] ?? '');
|
||||
$faq->question = $question;
|
||||
$faq->answer = $faqData['answer'] ?? [];
|
||||
$faq->ordering = $position;
|
||||
$faq->add();
|
||||
}
|
||||
@@ -181,11 +185,11 @@ final class CustomHtmlBlockDataHandler implements FormDataHandlerInterface
|
||||
|
||||
$slide = new CustomHtmlSlide();
|
||||
$slide->id_ws_customhtml = $idBlock;
|
||||
$slide->title = (string) ($slideData['title'] ?? '');
|
||||
$slide->description = (string) ($slideData['description'] ?? '');
|
||||
$slide->extra_description = (string) ($slideData['extra_description'] ?? '');
|
||||
$slide->link = (string) ($slideData['link'] ?? '');
|
||||
$slide->link_text = (string) ($slideData['link_text'] ?? '');
|
||||
$slide->title = $slideData['title'] ?? [];
|
||||
$slide->description = $slideData['description'] ?? [];
|
||||
$slide->extra_description = $slideData['extra_description'] ?? [];
|
||||
$slide->link = $slideData['link'] ?? [];
|
||||
$slide->link_text = $slideData['link_text'] ?? [];
|
||||
$slide->image = $this->saveUploadedImage($slideData['image'] ?? null, $existingImage);
|
||||
$slide->ordering = $position;
|
||||
$slide->add();
|
||||
|
||||
@@ -15,9 +15,10 @@ final class CustomHtmlGroupDataHandler implements FormDataHandlerInterface
|
||||
public function create(array $formData)
|
||||
{
|
||||
$group = new CustomHtmlGroup();
|
||||
$group->title = (string) $formData['title'];
|
||||
$group->title = $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();
|
||||
|
||||
@@ -47,9 +48,10 @@ final class CustomHtmlGroupDataHandler implements FormDataHandlerInterface
|
||||
return false;
|
||||
}
|
||||
|
||||
$group->title = (string) $formData['title'];
|
||||
$group->title = $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()) {
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
<?php
|
||||
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
|
||||
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
|
||||
header('Cache-Control: no-store, no-cache, must-revalidate');
|
||||
header('Cache-Control: post-check=0, pre-check=0', false);
|
||||
header('Pragma: no-cache');
|
||||
header('Location: ../');
|
||||
exit;
|
||||
@@ -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),
|
||||
@@ -48,22 +48,22 @@ final class CustomHtmlBlockDataProvider implements FormDataProviderInterface
|
||||
{
|
||||
return [
|
||||
'id_ws_customhtml_group' => 0,
|
||||
'title' => '',
|
||||
'title' => [],
|
||||
'type' => 'html',
|
||||
'show_title' => false,
|
||||
'custom_class' => '',
|
||||
'content' => '',
|
||||
'content' => [],
|
||||
'image' => null,
|
||||
'description' => '',
|
||||
'extra_description' => '',
|
||||
'link' => '',
|
||||
'link_text' => '',
|
||||
'description' => [],
|
||||
'extra_description' => [],
|
||||
'link' => [],
|
||||
'link_text' => [],
|
||||
'alert_type' => 'info',
|
||||
'timeout' => 0,
|
||||
'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' => [],
|
||||
|
||||
@@ -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,
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
<?php
|
||||
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
|
||||
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
|
||||
header('Cache-Control: no-store, no-cache, must-revalidate');
|
||||
header('Cache-Control: post-check=0, pre-check=0', false);
|
||||
header('Pragma: no-cache');
|
||||
header('Location: ../');
|
||||
exit;
|
||||
@@ -12,20 +12,25 @@ use Symfony\Component\Form\Extension\Core\Type\NumberType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\TextType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\TextareaType;
|
||||
use PrestaShop\PrestaShop\Core\Form\ConfigurableFormChoiceProviderInterface;
|
||||
use PrestaShopBundle\Form\Admin\Type\FormattedTextareaType;
|
||||
use PrestaShopBundle\Form\Admin\Type\SwitchType;
|
||||
use PrestaShopBundle\Form\Admin\Type\TranslatableType;
|
||||
use Symfony\Contracts\Translation\TranslatorInterface;
|
||||
use Websmid\CustomHtml\Config\Config;
|
||||
|
||||
class CustomHtmlBlockType extends AbstractType
|
||||
{
|
||||
private $translator;
|
||||
private $locales;
|
||||
private $groupChoiceProvider;
|
||||
|
||||
public function __construct(
|
||||
TranslatorInterface $translator,
|
||||
array $locales,
|
||||
ConfigurableFormChoiceProviderInterface $groupChoiceProvider
|
||||
) {
|
||||
$this->translator = $translator;
|
||||
$this->locales = $locales;
|
||||
$this->groupChoiceProvider = $groupChoiceProvider;
|
||||
}
|
||||
|
||||
@@ -33,17 +38,20 @@ 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'),
|
||||
'choices' => array_flip(Config::BLOCK_TYPES),
|
||||
'required' => true,
|
||||
])
|
||||
->add('title', TextType::class, [
|
||||
->add('title', TranslatableType::class, [
|
||||
'type' => TextType::class,
|
||||
'label' => $this->translator->trans('Title', [], 'Modules.Wscustomhtml.Admin'),
|
||||
'locales' => $this->locales,
|
||||
'required' => true,
|
||||
'row_attr' => ['class' => 'col-8'],
|
||||
])
|
||||
@@ -52,10 +60,11 @@ class CustomHtmlBlockType extends AbstractType
|
||||
'required' => false,
|
||||
'row_attr' => ['class' => 'col-3'],
|
||||
])
|
||||
->add('content', TextareaType::class, [
|
||||
->add('content', TranslatableType::class, [
|
||||
'type' => FormattedTextareaType::class,
|
||||
'label' => $this->translator->trans('Content', [], 'Modules.Wscustomhtml.Admin'),
|
||||
'locales' => $this->locales,
|
||||
'required' => false,
|
||||
'attr' => ['class' => 'autoload_rte'],
|
||||
'row_attr' => ['class' => 'customhtmlblock-type-field customhtmlblock-type-html'],
|
||||
])
|
||||
->add('image', FileType::class, [
|
||||
@@ -83,6 +92,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 +113,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, [
|
||||
@@ -127,26 +137,34 @@ class CustomHtmlBlockType extends AbstractType
|
||||
'help' => $this->translator->trans('0 means the alert never auto-dismisses; visitors can still close it manually.', [], 'Modules.Wscustomhtml.Admin'),
|
||||
'row_attr' => ['class' => 'customhtmlblock-type-field customhtmlblock-type-alert'],
|
||||
])
|
||||
->add('description', TextareaType::class, [
|
||||
->add('description', TranslatableType::class, [
|
||||
'type' => TextareaType::class,
|
||||
'label' => $this->translator->trans('Description', [], 'Modules.Wscustomhtml.Admin'),
|
||||
'locales' => $this->locales,
|
||||
'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, [
|
||||
->add('extra_description', TranslatableType::class, [
|
||||
'type' => TextareaType::class,
|
||||
'label' => $this->translator->trans('Extra description', [], 'Modules.Wscustomhtml.Admin'),
|
||||
'locales' => $this->locales,
|
||||
'required' => false,
|
||||
'row_attr' => ['class' => 'customhtmlblock-type-field customhtmlblock-type-banner'],
|
||||
])
|
||||
->add('link', TextType::class, [
|
||||
->add('link', TranslatableType::class, [
|
||||
'type' => TextType::class,
|
||||
'label' => $this->translator->trans('Link URL', [], 'Modules.Wscustomhtml.Admin'),
|
||||
'locales' => $this->locales,
|
||||
'required' => false,
|
||||
'attr' => ['placeholder' => 'https://example.com or /internal-page'],
|
||||
'row_attr' => ['class' => 'customhtmlblock-type-field customhtmlblock-type-banner customhtmlblock-type-usp customhtmlblock-type-alert col-6'],
|
||||
'options' => ['attr' => ['placeholder' => 'https://example.com or /internal-page']],
|
||||
'row_attr' => ['class' => 'customhtmlblock-type-field customhtmlblock-type-banner customhtmlblock-type-usp customhtmlblock-type-alert'],
|
||||
])
|
||||
->add('link_text', TextType::class, [
|
||||
->add('link_text', TranslatableType::class, [
|
||||
'type' => TextType::class,
|
||||
'label' => $this->translator->trans('Link text', [], 'Modules.Wscustomhtml.Admin'),
|
||||
'locales' => $this->locales,
|
||||
'required' => false,
|
||||
'attr' => ['placeholder' => 'Learn more'],
|
||||
'options' => ['attr' => ['placeholder' => 'Learn more']],
|
||||
'row_attr' => ['class' => 'customhtmlblock-type-field customhtmlblock-type-alert col-6'],
|
||||
])
|
||||
->add('custom_class', TextType::class, [
|
||||
|
||||
@@ -6,26 +6,33 @@ use Symfony\Component\Form\AbstractType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Component\Form\Extension\Core\Type\TextType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\TextareaType;
|
||||
use PrestaShopBundle\Form\Admin\Type\TranslatableType;
|
||||
use Symfony\Contracts\Translation\TranslatorInterface;
|
||||
|
||||
class CustomHtmlFaqType extends AbstractType
|
||||
{
|
||||
private $translator;
|
||||
private $locales;
|
||||
|
||||
public function __construct(TranslatorInterface $translator)
|
||||
public function __construct(TranslatorInterface $translator, array $locales)
|
||||
{
|
||||
$this->translator = $translator;
|
||||
$this->locales = $locales;
|
||||
}
|
||||
|
||||
public function buildForm(FormBuilderInterface $formBuilder, array $options): void
|
||||
{
|
||||
$formBuilder
|
||||
->add('question', TextType::class, [
|
||||
->add('question', TranslatableType::class, [
|
||||
'type' => TextType::class,
|
||||
'label' => $this->translator->trans('Question', [], 'Modules.Wscustomhtml.Admin'),
|
||||
'locales' => $this->locales,
|
||||
'required' => false,
|
||||
])
|
||||
->add('answer', TextareaType::class, [
|
||||
->add('answer', TranslatableType::class, [
|
||||
'type' => TextareaType::class,
|
||||
'label' => $this->translator->trans('Answer', [], 'Modules.Wscustomhtml.Admin'),
|
||||
'locales' => $this->locales,
|
||||
'required' => false,
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -6,22 +6,27 @@ use Symfony\Component\Form\AbstractType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Component\Form\Extension\Core\Type\TextType;
|
||||
use PrestaShopBundle\Form\Admin\Type\SwitchType;
|
||||
use PrestaShopBundle\Form\Admin\Type\TranslatableType;
|
||||
use Symfony\Contracts\Translation\TranslatorInterface;
|
||||
|
||||
class CustomHtmlGroupType extends AbstractType
|
||||
{
|
||||
private $translator;
|
||||
private $locales;
|
||||
|
||||
public function __construct(TranslatorInterface $translator)
|
||||
public function __construct(TranslatorInterface $translator, array $locales)
|
||||
{
|
||||
$this->translator = $translator;
|
||||
$this->locales = $locales;
|
||||
}
|
||||
|
||||
public function buildForm(FormBuilderInterface $formBuilder, array $options): void
|
||||
{
|
||||
$formBuilder
|
||||
->add('title', TextType::class, [
|
||||
->add('title', TranslatableType::class, [
|
||||
'type' => TextType::class,
|
||||
'label' => $this->translator->trans('Title', [], 'Modules.Wscustomhtml.Admin'),
|
||||
'locales' => $this->locales,
|
||||
'required' => true,
|
||||
])
|
||||
->add('hook_name', TextType::class, [
|
||||
@@ -29,10 +34,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,
|
||||
|
||||
@@ -8,15 +8,18 @@ use Symfony\Component\Form\Extension\Core\Type\FileType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\HiddenType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\TextType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\TextareaType;
|
||||
use PrestaShopBundle\Form\Admin\Type\TranslatableType;
|
||||
use Symfony\Contracts\Translation\TranslatorInterface;
|
||||
|
||||
class CustomHtmlSlideType extends AbstractType
|
||||
{
|
||||
private $translator;
|
||||
private $locales;
|
||||
|
||||
public function __construct(TranslatorInterface $translator)
|
||||
public function __construct(TranslatorInterface $translator, array $locales)
|
||||
{
|
||||
$this->translator = $translator;
|
||||
$this->locales = $locales;
|
||||
}
|
||||
|
||||
public function buildForm(FormBuilderInterface $formBuilder, array $options): void
|
||||
@@ -25,27 +28,37 @@ class CustomHtmlSlideType extends AbstractType
|
||||
->add('id', HiddenType::class, [
|
||||
'required' => false,
|
||||
])
|
||||
->add('title', TextType::class, [
|
||||
->add('title', TranslatableType::class, [
|
||||
'type' => TextType::class,
|
||||
'label' => $this->translator->trans('Title', [], 'Modules.Wscustomhtml.Admin'),
|
||||
'locales' => $this->locales,
|
||||
'required' => false,
|
||||
])
|
||||
->add('description', TextareaType::class, [
|
||||
->add('description', TranslatableType::class, [
|
||||
'type' => TextareaType::class,
|
||||
'label' => $this->translator->trans('Description', [], 'Modules.Wscustomhtml.Admin'),
|
||||
'locales' => $this->locales,
|
||||
'required' => false,
|
||||
])
|
||||
->add('extra_description', TextareaType::class, [
|
||||
->add('extra_description', TranslatableType::class, [
|
||||
'type' => TextareaType::class,
|
||||
'label' => $this->translator->trans('Extra description', [], 'Modules.Wscustomhtml.Admin'),
|
||||
'locales' => $this->locales,
|
||||
'required' => false,
|
||||
])
|
||||
->add('link', TextType::class, [
|
||||
->add('link', TranslatableType::class, [
|
||||
'type' => TextType::class,
|
||||
'label' => $this->translator->trans('Link URL', [], 'Modules.Wscustomhtml.Admin'),
|
||||
'locales' => $this->locales,
|
||||
'required' => false,
|
||||
'attr' => ['placeholder' => 'https://example.com or /internal-page'],
|
||||
'options' => ['attr' => ['placeholder' => 'https://example.com or /internal-page']],
|
||||
])
|
||||
->add('link_text', TextType::class, [
|
||||
->add('link_text', TranslatableType::class, [
|
||||
'type' => TextType::class,
|
||||
'label' => $this->translator->trans('Link text', [], 'Modules.Wscustomhtml.Admin'),
|
||||
'locales' => $this->locales,
|
||||
'required' => false,
|
||||
'attr' => ['placeholder' => 'Learn more'],
|
||||
'options' => ['attr' => ['placeholder' => 'Learn more']],
|
||||
])
|
||||
->add('image', FileType::class, [
|
||||
'label' => $this->translator->trans('Image', [], 'Modules.Wscustomhtml.Admin'),
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
<?php
|
||||
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
|
||||
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
|
||||
header('Cache-Control: no-store, no-cache, must-revalidate');
|
||||
header('Cache-Control: post-check=0, pre-check=0', false);
|
||||
header('Pragma: no-cache');
|
||||
header('Location: ../');
|
||||
exit;
|
||||
@@ -0,0 +1,8 @@
|
||||
<?php
|
||||
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
|
||||
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
|
||||
header('Cache-Control: no-store, no-cache, must-revalidate');
|
||||
header('Cache-Control: post-check=0, pre-check=0', false);
|
||||
header('Pragma: no-cache');
|
||||
header('Location: ../');
|
||||
exit;
|
||||
@@ -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']
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,6 +9,7 @@ use PrestaShop\PrestaShop\Core\Grid\Action\Type\SimpleGridAction;
|
||||
use PrestaShop\PrestaShop\Core\Grid\Column\ColumnCollection;
|
||||
use PrestaShop\PrestaShop\Core\Grid\Column\Type\Common\ActionColumn;
|
||||
use PrestaShop\PrestaShop\Core\Grid\Column\Type\Common\PositionColumn;
|
||||
use PrestaShop\PrestaShop\Core\Grid\Column\Type\Common\ToggleColumn;
|
||||
use PrestaShop\PrestaShop\Core\Grid\Column\Type\DataColumn;
|
||||
use PrestaShop\PrestaShop\Core\Grid\Definition\Factory\AbstractGridDefinitionFactory;
|
||||
use PrestaShop\PrestaShop\Core\Grid\Definition\Factory\DeleteActionTrait;
|
||||
@@ -72,20 +73,20 @@ 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'))
|
||||
->setOptions(['field' => 'blocks_count', 'sortable' => false])
|
||||
)
|
||||
->add(
|
||||
(new DataColumn('active'))
|
||||
(new ToggleColumn('active'))
|
||||
->setName($this->trans('Active', [], 'Admin.Global'))
|
||||
->setOptions(['field' => 'active'])
|
||||
->setOptions([
|
||||
'field' => 'active',
|
||||
'primary_field' => 'id_ws_customhtml_group',
|
||||
'route' => 'customhtmlgroup_toggle',
|
||||
'route_param_name' => 'idCustomHtmlGroup',
|
||||
])
|
||||
)
|
||||
->add(
|
||||
(new PositionColumn('position'))
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
<?php
|
||||
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
|
||||
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
|
||||
header('Cache-Control: no-store, no-cache, must-revalidate');
|
||||
header('Cache-Control: post-check=0, pre-check=0', false);
|
||||
header('Pragma: no-cache');
|
||||
header('Location: ../');
|
||||
exit;
|
||||
@@ -0,0 +1,8 @@
|
||||
<?php
|
||||
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
|
||||
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
|
||||
header('Cache-Control: no-store, no-cache, must-revalidate');
|
||||
header('Cache-Control: post-check=0, pre-check=0', false);
|
||||
header('Pragma: no-cache');
|
||||
header('Location: ../');
|
||||
exit;
|
||||
@@ -0,0 +1,8 @@
|
||||
<?php
|
||||
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
|
||||
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
|
||||
header('Cache-Control: no-store, no-cache, must-revalidate');
|
||||
header('Cache-Control: post-check=0, pre-check=0', false);
|
||||
header('Pragma: no-cache');
|
||||
header('Location: ../');
|
||||
exit;
|
||||
@@ -11,6 +11,8 @@ use PrestaShop\PrestaShop\Core\Grid\Search\SearchCriteriaInterface;
|
||||
|
||||
final class CustomHtmlBlockQueryBuilder extends AbstractDoctrineQueryBuilder
|
||||
{
|
||||
private $contextLanguageId;
|
||||
|
||||
public function __construct(
|
||||
Connection $connection,
|
||||
string $dbPrefix,
|
||||
@@ -22,6 +24,8 @@ final class CustomHtmlBlockQueryBuilder extends AbstractDoctrineQueryBuilder
|
||||
Configuration $configuration
|
||||
) {
|
||||
parent::__construct($connection, $dbPrefix);
|
||||
|
||||
$this->contextLanguageId = $contextLanguageId;
|
||||
}
|
||||
|
||||
public function getSearchQueryBuilder(SearchCriteriaInterface $searchCriteria)
|
||||
@@ -31,8 +35,8 @@ final class CustomHtmlBlockQueryBuilder extends AbstractDoctrineQueryBuilder
|
||||
$qb->select(
|
||||
'wchb.`id_ws_customhtml`',
|
||||
'wchb.`id_ws_customhtml_group`',
|
||||
'wchb.`title`',
|
||||
'wchg.`title` AS group_title',
|
||||
'wchbl.`title`',
|
||||
'wchgl.`title` AS group_title',
|
||||
'wchb.`type`',
|
||||
'wchb.`active`',
|
||||
'wchb.`ordering`',
|
||||
@@ -71,6 +75,18 @@ final class CustomHtmlBlockQueryBuilder extends AbstractDoctrineQueryBuilder
|
||||
$this->dbPrefix . 'ws_customhtml_group',
|
||||
'wchg',
|
||||
'wchg.`id_ws_customhtml_group` = wchb.`id_ws_customhtml_group`'
|
||||
)
|
||||
->leftJoin(
|
||||
'wchb',
|
||||
$this->dbPrefix . 'ws_customhtml_group_lang',
|
||||
'wchgl',
|
||||
'wchgl.`id_ws_customhtml_group` = wchb.`id_ws_customhtml_group` AND wchgl.`id_lang` = ' . (int) $this->contextLanguageId
|
||||
)
|
||||
->leftJoin(
|
||||
'wchb',
|
||||
$this->dbPrefix . 'ws_customhtml_lang',
|
||||
'wchbl',
|
||||
'wchbl.`id_ws_customhtml` = wchb.`id_ws_customhtml` AND wchbl.`id_lang` = ' . (int) $this->contextLanguageId
|
||||
);
|
||||
}
|
||||
|
||||
@@ -93,8 +109,14 @@ final class CustomHtmlBlockQueryBuilder extends AbstractDoctrineQueryBuilder
|
||||
continue;
|
||||
}
|
||||
|
||||
if ($filterName === 'title') {
|
||||
$qb->andWhere('wchbl.`title` LIKE :title')
|
||||
->setParameter('title', '%' . pSQL($filterValue) . '%');
|
||||
continue;
|
||||
}
|
||||
|
||||
if ($filterName === 'group_title') {
|
||||
$qb->andWhere('wchg.`title` LIKE :group_title')
|
||||
$qb->andWhere('wchgl.`title` LIKE :group_title')
|
||||
->setParameter('group_title', '%' . pSQL($filterValue) . '%');
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -11,6 +11,8 @@ use PrestaShop\PrestaShop\Core\Grid\Search\SearchCriteriaInterface;
|
||||
|
||||
final class CustomHtmlGroupQueryBuilder extends AbstractDoctrineQueryBuilder
|
||||
{
|
||||
private $contextLanguageId;
|
||||
|
||||
public function __construct(
|
||||
Connection $connection,
|
||||
string $dbPrefix,
|
||||
@@ -22,6 +24,8 @@ final class CustomHtmlGroupQueryBuilder extends AbstractDoctrineQueryBuilder
|
||||
Configuration $configuration
|
||||
) {
|
||||
parent::__construct($connection, $dbPrefix);
|
||||
|
||||
$this->contextLanguageId = $contextLanguageId;
|
||||
}
|
||||
|
||||
public function getSearchQueryBuilder(SearchCriteriaInterface $searchCriteria)
|
||||
@@ -30,7 +34,7 @@ final class CustomHtmlGroupQueryBuilder extends AbstractDoctrineQueryBuilder
|
||||
|
||||
$qb->select(
|
||||
'wchg.`id_ws_customhtml_group`',
|
||||
'wchg.`title`',
|
||||
'wchgl.`title`',
|
||||
'wchg.`hook_name`',
|
||||
'wchg.`custom_class`',
|
||||
'wchg.`active`',
|
||||
@@ -66,7 +70,13 @@ final class CustomHtmlGroupQueryBuilder extends AbstractDoctrineQueryBuilder
|
||||
{
|
||||
return $this->connection
|
||||
->createQueryBuilder()
|
||||
->from($this->dbPrefix . 'ws_customhtml_group', 'wchg');
|
||||
->from($this->dbPrefix . 'ws_customhtml_group', 'wchg')
|
||||
->leftJoin(
|
||||
'wchg',
|
||||
$this->dbPrefix . 'ws_customhtml_group_lang',
|
||||
'wchgl',
|
||||
'wchgl.`id_ws_customhtml_group` = wchg.`id_ws_customhtml_group` AND wchgl.`id_lang` = ' . (int) $this->contextLanguageId
|
||||
);
|
||||
}
|
||||
|
||||
private function applyFilters($qb, SearchCriteriaInterface $searchCriteria): void
|
||||
@@ -82,6 +92,12 @@ final class CustomHtmlGroupQueryBuilder extends AbstractDoctrineQueryBuilder
|
||||
continue;
|
||||
}
|
||||
|
||||
if ($filterName === 'title') {
|
||||
$qb->andWhere('wchgl.`title` LIKE :title')
|
||||
->setParameter('title', '%' . pSQL($filterValue) . '%');
|
||||
continue;
|
||||
}
|
||||
|
||||
$qb->andWhere('wchg.`' . $filterName . '` LIKE :' . $filterName)
|
||||
->setParameter($filterName, '%' . pSQL($filterValue) . '%');
|
||||
}
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
<?php
|
||||
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
|
||||
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
|
||||
header('Cache-Control: no-store, no-cache, must-revalidate');
|
||||
header('Cache-Control: post-check=0, pre-check=0', false);
|
||||
header('Pragma: no-cache');
|
||||
header('Location: ../');
|
||||
exit;
|
||||
@@ -0,0 +1,8 @@
|
||||
<?php
|
||||
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
|
||||
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
|
||||
header('Cache-Control: no-store, no-cache, must-revalidate');
|
||||
header('Cache-Control: post-check=0, pre-check=0', false);
|
||||
header('Pragma: no-cache');
|
||||
header('Location: ../');
|
||||
exit;
|
||||
@@ -77,18 +77,19 @@ class CustomHtmlBlock extends ObjectModel
|
||||
public $date_upd;
|
||||
|
||||
public static $definition = [
|
||||
'table' => 'ws_customhtml',
|
||||
'primary' => 'id_ws_customhtml',
|
||||
'fields' => [
|
||||
'table' => 'ws_customhtml',
|
||||
'primary' => 'id_ws_customhtml',
|
||||
'multilang' => true,
|
||||
'fields' => [
|
||||
'id_ws_customhtml_group' => ['type' => self::TYPE_INT, 'validate' => 'isUnsignedId', 'required' => true],
|
||||
'title' => ['type' => self::TYPE_STRING, 'validate' => 'isGenericName', 'required' => true, 'size' => 256],
|
||||
'title' => ['type' => self::TYPE_STRING, 'validate' => 'isGenericName', 'required' => true, 'size' => 256, 'lang' => true],
|
||||
'type' => ['type' => self::TYPE_STRING, 'validate' => 'isGenericName', 'required' => true, 'size' => 32],
|
||||
'content' => ['type' => self::TYPE_HTML, 'validate' => 'isCleanHtml'],
|
||||
'content' => ['type' => self::TYPE_HTML, 'validate' => 'isCleanHtml', 'lang' => true],
|
||||
'custom_class' => ['type' => self::TYPE_STRING, 'validate' => 'isGenericName', 'required' => false, 'size' => 128],
|
||||
'description' => ['type' => self::TYPE_STRING, 'validate' => 'isGenericName', 'required' => false, 'size' => 1024],
|
||||
'extra_description' => ['type' => self::TYPE_STRING, 'validate' => 'isGenericName', 'required' => false, 'size' => 1024],
|
||||
'link' => ['type' => self::TYPE_STRING, 'validate' => 'isGenericName', 'required' => false, 'size' => 512],
|
||||
'link_text' => ['type' => self::TYPE_STRING, 'validate' => 'isGenericName', 'required' => false, 'size' => 128],
|
||||
'description' => ['type' => self::TYPE_STRING, 'validate' => 'isGenericName', 'required' => false, 'size' => 1024, 'lang' => true],
|
||||
'extra_description' => ['type' => self::TYPE_STRING, 'validate' => 'isGenericName', 'required' => false, 'size' => 1024, 'lang' => true],
|
||||
'link' => ['type' => self::TYPE_STRING, 'validate' => 'isGenericName', 'required' => false, 'size' => 512, 'lang' => true],
|
||||
'link_text' => ['type' => self::TYPE_STRING, 'validate' => 'isGenericName', 'required' => false, 'size' => 128, 'lang' => true],
|
||||
'image' => ['type' => self::TYPE_STRING, 'validate' => 'isGenericName', 'required' => false, 'size' => 255],
|
||||
'alert_type' => ['type' => self::TYPE_STRING, 'validate' => 'isGenericName', 'required' => false, 'size' => 16],
|
||||
'timeout' => ['type' => self::TYPE_INT, 'validate' => 'isUnsignedInt', 'required' => false],
|
||||
@@ -119,7 +120,7 @@ class CustomHtmlBlock extends ObjectModel
|
||||
return _MODULE_DIR_ . 'ws_customhtml/views/img/banners/' . $filename;
|
||||
}
|
||||
|
||||
public static function getActiveByGroupIds(array $groupIds): array
|
||||
public static function getActiveByGroupIds(array $groupIds, int $idLang): array
|
||||
{
|
||||
$groupIds = array_map('intval', $groupIds);
|
||||
|
||||
@@ -128,14 +129,16 @@ class CustomHtmlBlock extends ObjectModel
|
||||
}
|
||||
|
||||
$result = Db::getInstance()->executeS(
|
||||
'SELECT `id_ws_customhtml`, `id_ws_customhtml_group`, `title`, `type`, `content`, `custom_class`,
|
||||
`description`, `extra_description`, `link`, `link_text`, `image`, `alert_type`, `timeout`,
|
||||
`slider_mode`, `slides_per_view_mobile`, `slides_per_view_tablet`, `slides_per_view_desktop`, `autoplay_delay`,
|
||||
`active`, `show_title`, `ordering`
|
||||
FROM `' . _DB_PREFIX_ . 'ws_customhtml`
|
||||
WHERE `id_ws_customhtml_group` IN (' . implode(',', $groupIds) . ')
|
||||
AND `active` = 1
|
||||
ORDER BY `ordering` ASC'
|
||||
'SELECT wch.`id_ws_customhtml`, wch.`id_ws_customhtml_group`, wchl.`title`, wch.`type`, wchl.`content`, wch.`custom_class`,
|
||||
wchl.`description`, wchl.`extra_description`, wchl.`link`, wchl.`link_text`, wch.`image`, wch.`alert_type`, wch.`timeout`,
|
||||
wch.`slider_mode`, wch.`slides_per_view_mobile`, wch.`slides_per_view_tablet`, wch.`slides_per_view_desktop`, wch.`autoplay_delay`,
|
||||
wch.`active`, wch.`show_title`, wch.`ordering`
|
||||
FROM `' . _DB_PREFIX_ . 'ws_customhtml` wch
|
||||
LEFT JOIN `' . _DB_PREFIX_ . 'ws_customhtml_lang` wchl
|
||||
ON wchl.`id_ws_customhtml` = wch.`id_ws_customhtml` AND wchl.`id_lang` = ' . (int) $idLang . '
|
||||
WHERE wch.`id_ws_customhtml_group` IN (' . implode(',', $groupIds) . ')
|
||||
AND wch.`active` = 1
|
||||
ORDER BY wch.`ordering` ASC'
|
||||
);
|
||||
|
||||
$blocksByGroup = [];
|
||||
|
||||
@@ -29,27 +29,56 @@ class CustomHtmlFaq extends ObjectModel
|
||||
public $date_upd;
|
||||
|
||||
public static $definition = [
|
||||
'table' => 'ws_customhtml_faq',
|
||||
'primary' => 'id_ws_customhtml_faq',
|
||||
'fields' => [
|
||||
'table' => 'ws_customhtml_faq',
|
||||
'primary' => 'id_ws_customhtml_faq',
|
||||
'multilang' => true,
|
||||
'fields' => [
|
||||
'id_ws_customhtml' => ['type' => self::TYPE_INT, 'validate' => 'isUnsignedId', 'required' => true],
|
||||
'question' => ['type' => self::TYPE_STRING, 'validate' => 'isGenericName', 'required' => true, 'size' => 512],
|
||||
'answer' => ['type' => self::TYPE_HTML, 'validate' => 'isCleanHtml'],
|
||||
'question' => ['type' => self::TYPE_STRING, 'validate' => 'isGenericName', 'required' => true, 'size' => 512, 'lang' => true],
|
||||
'answer' => ['type' => self::TYPE_HTML, 'validate' => 'isCleanHtml', 'lang' => true],
|
||||
'ordering' => ['type' => self::TYPE_INT, 'validate' => 'isInt'],
|
||||
'date_add' => ['type' => self::TYPE_DATE, 'validate' => 'isDate'],
|
||||
'date_upd' => ['type' => self::TYPE_DATE, 'validate' => 'isDate'],
|
||||
],
|
||||
];
|
||||
|
||||
/**
|
||||
* Admin use — loads every language into lang fields as [id_lang => value] arrays.
|
||||
*/
|
||||
public static function getByBlockId(int $idBlock): array
|
||||
{
|
||||
$result = Db::getInstance()->executeS(
|
||||
'SELECT `id_ws_customhtml_faq`, `question`, `answer`, `ordering`
|
||||
FROM `' . _DB_PREFIX_ . 'ws_customhtml_faq`
|
||||
$ids = Db::getInstance()->executeS(
|
||||
'SELECT `id_ws_customhtml_faq` FROM `' . _DB_PREFIX_ . 'ws_customhtml_faq`
|
||||
WHERE `id_ws_customhtml` = ' . (int) $idBlock . '
|
||||
ORDER BY `ordering` ASC'
|
||||
);
|
||||
|
||||
return array_map(static function (array $row) {
|
||||
$faq = new self((int) $row['id_ws_customhtml_faq']);
|
||||
|
||||
return [
|
||||
'id_ws_customhtml_faq' => (int) $faq->id,
|
||||
'question' => $faq->question,
|
||||
'answer' => $faq->answer,
|
||||
'ordering' => (int) $faq->ordering,
|
||||
];
|
||||
}, $ids ?: []);
|
||||
}
|
||||
|
||||
/**
|
||||
* Front-end use — resolves lang fields to plain strings for one language.
|
||||
*/
|
||||
public static function getByBlockIdForLang(int $idBlock, int $idLang): array
|
||||
{
|
||||
$result = Db::getInstance()->executeS(
|
||||
'SELECT wcf.`id_ws_customhtml_faq`, wcfl.`question`, wcfl.`answer`, wcf.`ordering`
|
||||
FROM `' . _DB_PREFIX_ . 'ws_customhtml_faq` wcf
|
||||
LEFT JOIN `' . _DB_PREFIX_ . 'ws_customhtml_faq_lang` wcfl
|
||||
ON wcfl.`id_ws_customhtml_faq` = wcf.`id_ws_customhtml_faq` AND wcfl.`id_lang` = ' . (int) $idLang . '
|
||||
WHERE wcf.`id_ws_customhtml` = ' . (int) $idBlock . '
|
||||
ORDER BY wcf.`ordering` ASC'
|
||||
);
|
||||
|
||||
return $result ?: [];
|
||||
}
|
||||
|
||||
|
||||
@@ -19,6 +19,9 @@ class CustomHtmlGroup extends ObjectModel
|
||||
/** @var string */
|
||||
public $custom_class = '';
|
||||
|
||||
/** @var string */
|
||||
public $default_block_class = '';
|
||||
|
||||
/** @var int */
|
||||
public $active = 1;
|
||||
|
||||
@@ -32,12 +35,14 @@ class CustomHtmlGroup extends ObjectModel
|
||||
public $date_upd;
|
||||
|
||||
public static $definition = [
|
||||
'table' => 'ws_customhtml_group',
|
||||
'primary' => 'id_ws_customhtml_group',
|
||||
'fields' => [
|
||||
'table' => 'ws_customhtml_group',
|
||||
'primary' => 'id_ws_customhtml_group',
|
||||
'multilang' => true,
|
||||
'fields' => [
|
||||
'hook_name' => ['type' => self::TYPE_STRING, 'validate' => 'isGenericName', 'required' => true, 'size' => 64],
|
||||
'title' => ['type' => self::TYPE_STRING, 'validate' => 'isGenericName', 'required' => true, 'size' => 256],
|
||||
'title' => ['type' => self::TYPE_STRING, 'validate' => 'isGenericName', 'required' => true, 'size' => 256, 'lang' => true],
|
||||
'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 +53,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`, `active`, `custom_class`, `default_block_class`, `ordering`
|
||||
FROM `' . _DB_PREFIX_ . 'ws_customhtml_group`
|
||||
WHERE `hook_name` = \'' . pSQL($hookName) . '\'
|
||||
AND `active` = 1
|
||||
|
||||
@@ -41,15 +41,16 @@ class CustomHtmlSlide extends ObjectModel
|
||||
public $date_upd;
|
||||
|
||||
public static $definition = [
|
||||
'table' => 'ws_customhtml_slide',
|
||||
'primary' => 'id_ws_customhtml_slide',
|
||||
'fields' => [
|
||||
'table' => 'ws_customhtml_slide',
|
||||
'primary' => 'id_ws_customhtml_slide',
|
||||
'multilang' => true,
|
||||
'fields' => [
|
||||
'id_ws_customhtml' => ['type' => self::TYPE_INT, 'validate' => 'isUnsignedId', 'required' => true],
|
||||
'title' => ['type' => self::TYPE_STRING, 'validate' => 'isGenericName', 'required' => false, 'size' => 256],
|
||||
'description' => ['type' => self::TYPE_STRING, 'validate' => 'isGenericName', 'required' => false, 'size' => 1024],
|
||||
'extra_description' => ['type' => self::TYPE_STRING, 'validate' => 'isGenericName', 'required' => false, 'size' => 1024],
|
||||
'link' => ['type' => self::TYPE_STRING, 'validate' => 'isGenericName', 'required' => false, 'size' => 512],
|
||||
'link_text' => ['type' => self::TYPE_STRING, 'validate' => 'isGenericName', 'required' => false, 'size' => 128],
|
||||
'title' => ['type' => self::TYPE_STRING, 'validate' => 'isGenericName', 'required' => false, 'size' => 256, 'lang' => true],
|
||||
'description' => ['type' => self::TYPE_STRING, 'validate' => 'isGenericName', 'required' => false, 'size' => 1024, 'lang' => true],
|
||||
'extra_description' => ['type' => self::TYPE_STRING, 'validate' => 'isGenericName', 'required' => false, 'size' => 1024, 'lang' => true],
|
||||
'link' => ['type' => self::TYPE_STRING, 'validate' => 'isGenericName', 'required' => false, 'size' => 512, 'lang' => true],
|
||||
'link_text' => ['type' => self::TYPE_STRING, 'validate' => 'isGenericName', 'required' => false, 'size' => 128, 'lang' => true],
|
||||
'image' => ['type' => self::TYPE_STRING, 'validate' => 'isGenericName', 'required' => false, 'size' => 255],
|
||||
'ordering' => ['type' => self::TYPE_INT, 'validate' => 'isInt'],
|
||||
'date_add' => ['type' => self::TYPE_DATE, 'validate' => 'isDate'],
|
||||
@@ -57,15 +58,48 @@ class CustomHtmlSlide extends ObjectModel
|
||||
],
|
||||
];
|
||||
|
||||
/**
|
||||
* Admin use — loads every language into lang fields as [id_lang => value] arrays.
|
||||
*/
|
||||
public static function getByBlockId(int $idBlock): array
|
||||
{
|
||||
$result = Db::getInstance()->executeS(
|
||||
'SELECT `id_ws_customhtml_slide`, `title`, `description`, `extra_description`, `link`, `link_text`, `image`, `ordering`
|
||||
FROM `' . _DB_PREFIX_ . 'ws_customhtml_slide`
|
||||
$ids = Db::getInstance()->executeS(
|
||||
'SELECT `id_ws_customhtml_slide` FROM `' . _DB_PREFIX_ . 'ws_customhtml_slide`
|
||||
WHERE `id_ws_customhtml` = ' . (int) $idBlock . '
|
||||
ORDER BY `ordering` ASC'
|
||||
);
|
||||
|
||||
return array_map(static function (array $row) {
|
||||
$slide = new self((int) $row['id_ws_customhtml_slide']);
|
||||
|
||||
return [
|
||||
'id_ws_customhtml_slide' => (int) $slide->id,
|
||||
'title' => $slide->title,
|
||||
'description' => $slide->description,
|
||||
'extra_description' => $slide->extra_description,
|
||||
'link' => $slide->link,
|
||||
'link_text' => $slide->link_text,
|
||||
'image' => $slide->image,
|
||||
'ordering' => (int) $slide->ordering,
|
||||
];
|
||||
}, $ids ?: []);
|
||||
}
|
||||
|
||||
/**
|
||||
* Front-end use — resolves lang fields to plain strings for one language.
|
||||
*/
|
||||
public static function getByBlockIdForLang(int $idBlock, int $idLang): array
|
||||
{
|
||||
$result = Db::getInstance()->executeS(
|
||||
'SELECT wcs.`id_ws_customhtml_slide`, wcsl.`title`, wcsl.`description`, wcsl.`extra_description`,
|
||||
wcsl.`link`, wcsl.`link_text`, wcs.`image`, wcs.`ordering`
|
||||
FROM `' . _DB_PREFIX_ . 'ws_customhtml_slide` wcs
|
||||
LEFT JOIN `' . _DB_PREFIX_ . 'ws_customhtml_slide_lang` wcsl
|
||||
ON wcsl.`id_ws_customhtml_slide` = wcs.`id_ws_customhtml_slide` AND wcsl.`id_lang` = ' . (int) $idLang . '
|
||||
WHERE wcs.`id_ws_customhtml` = ' . (int) $idBlock . '
|
||||
ORDER BY wcs.`ordering` ASC'
|
||||
);
|
||||
|
||||
return $result ?: [];
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
<?php
|
||||
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
|
||||
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
|
||||
header('Cache-Control: no-store, no-cache, must-revalidate');
|
||||
header('Cache-Control: post-check=0, pre-check=0', false);
|
||||
header('Pragma: no-cache');
|
||||
header('Location: ../');
|
||||
exit;
|
||||
+25
-17
@@ -49,7 +49,8 @@ trait DisplayHooks
|
||||
|
||||
public function getWidgetVariables($hookName = null, array $configuration = [])
|
||||
{
|
||||
$groupList = $this->loadActiveGroupsWithBlocks((string) $hookName);
|
||||
$idLang = (int) Context::getContext()->language->id;
|
||||
$groupList = $this->loadActiveGroupsWithBlocks((string) $hookName, $idLang);
|
||||
|
||||
if (empty($groupList)) {
|
||||
return [];
|
||||
@@ -61,7 +62,7 @@ trait DisplayHooks
|
||||
];
|
||||
}
|
||||
|
||||
private function loadActiveGroupsWithBlocks(string $hookName): array
|
||||
private function loadActiveGroupsWithBlocks(string $hookName, int $idLang): array
|
||||
{
|
||||
$groups = CustomHtmlGroup::getActiveByHookName($hookName);
|
||||
|
||||
@@ -69,10 +70,10 @@ trait DisplayHooks
|
||||
return [];
|
||||
}
|
||||
|
||||
$blocksByGroup = CustomHtmlBlock::getActiveByGroupIds(array_column($groups, 'id_ws_customhtml_group'));
|
||||
$blocksByGroup = $this->attachFaqsToBlocks($blocksByGroup);
|
||||
$blocksByGroup = CustomHtmlBlock::getActiveByGroupIds(array_column($groups, 'id_ws_customhtml_group'), $idLang);
|
||||
$blocksByGroup = $this->attachFaqsToBlocks($blocksByGroup, $idLang);
|
||||
$blocksByGroup = $this->attachImageUrls($blocksByGroup);
|
||||
$blocksByGroup = $this->attachSlidesToBlocks($blocksByGroup);
|
||||
$blocksByGroup = $this->attachSlidesToBlocks($blocksByGroup, $idLang);
|
||||
|
||||
$groups = array_map(static function (array $group) use ($blocksByGroup) {
|
||||
$group['blocks'] = $blocksByGroup[(int) $group['id_ws_customhtml_group']] ?? [];
|
||||
@@ -85,12 +86,12 @@ trait DisplayHooks
|
||||
}));
|
||||
}
|
||||
|
||||
private function attachFaqsToBlocks(array $blocksByGroup): array
|
||||
private function attachFaqsToBlocks(array $blocksByGroup, int $idLang): array
|
||||
{
|
||||
return array_map(static function (array $blocks) {
|
||||
return array_map(static function (array $block) {
|
||||
return array_map(static function (array $blocks) use ($idLang) {
|
||||
return array_map(static function (array $block) use ($idLang) {
|
||||
if ($block['type'] === 'faq') {
|
||||
$block['faqs'] = CustomHtmlFaq::getByBlockId((int) $block['id_ws_customhtml']);
|
||||
$block['faqs'] = CustomHtmlFaq::getByBlockIdForLang((int) $block['id_ws_customhtml'], $idLang);
|
||||
}
|
||||
|
||||
return $block;
|
||||
@@ -111,12 +112,12 @@ trait DisplayHooks
|
||||
}, $blocksByGroup);
|
||||
}
|
||||
|
||||
private function attachSlidesToBlocks(array $blocksByGroup): array
|
||||
private function attachSlidesToBlocks(array $blocksByGroup, int $idLang): array
|
||||
{
|
||||
return array_map(function (array $blocks) {
|
||||
return array_map(function (array $block) {
|
||||
return array_map(function (array $blocks) use ($idLang) {
|
||||
return array_map(function (array $block) use ($idLang) {
|
||||
if ($block['type'] === 'slider') {
|
||||
$block['slides'] = $this->loadSlidesForBlock((int) $block['id_ws_customhtml']);
|
||||
$block['slides'] = $this->loadSlidesForBlock((int) $block['id_ws_customhtml'], $idLang);
|
||||
$block['slider_config'] = $this->buildSliderConfig($block);
|
||||
$block['slider_desktop_column_width'] = $this->buildSliderDesktopColumnWidth($block);
|
||||
}
|
||||
@@ -126,14 +127,14 @@ trait DisplayHooks
|
||||
}, $blocksByGroup);
|
||||
}
|
||||
|
||||
private function loadSlidesForBlock(int $idBlock): array
|
||||
private function loadSlidesForBlock(int $idBlock, int $idLang): array
|
||||
{
|
||||
return array_map(static function (array $slide) {
|
||||
$slide['image_url'] = CustomHtmlBlock::getBannerImageUrl($slide['image']);
|
||||
$slide['show_title'] = true;
|
||||
|
||||
return $slide;
|
||||
}, CustomHtmlSlide::getByBlockId($idBlock));
|
||||
}, CustomHtmlSlide::getByBlockIdForLang($idBlock, $idLang));
|
||||
}
|
||||
|
||||
private function buildSliderConfig(array $block): string
|
||||
@@ -152,8 +153,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 +171,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) . '%';
|
||||
|
||||
+47
-14
@@ -49,8 +49,8 @@ trait Install
|
||||
CREATE TABLE IF NOT EXISTS ' . _DB_PREFIX_ . 'ws_customhtml_group (
|
||||
`id_ws_customhtml_group` INT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
||||
`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,
|
||||
@@ -58,18 +58,21 @@ trait Install
|
||||
);
|
||||
';
|
||||
|
||||
$sqlToExec[] = '
|
||||
CREATE TABLE IF NOT EXISTS ' . _DB_PREFIX_ . 'ws_customhtml_group_lang (
|
||||
`id_ws_customhtml_group` INT(11) NOT NULL,
|
||||
`id_lang` INT(11) NOT NULL,
|
||||
`title` VARCHAR(256) NOT NULL DEFAULT \'\',
|
||||
PRIMARY KEY (`id_ws_customhtml_group`, `id_lang`)
|
||||
);
|
||||
';
|
||||
|
||||
$sqlToExec[] = '
|
||||
CREATE TABLE IF NOT EXISTS ' . _DB_PREFIX_ . 'ws_customhtml (
|
||||
`id_ws_customhtml` INT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
||||
`id_ws_customhtml_group` INT(11) NOT NULL,
|
||||
`title` VARCHAR(256) NOT NULL DEFAULT \'\',
|
||||
`type` VARCHAR(32) NOT NULL DEFAULT \'html\',
|
||||
`content` LONGTEXT,
|
||||
`custom_class` VARCHAR(128) NOT NULL DEFAULT \'\',
|
||||
`description` TEXT,
|
||||
`extra_description` TEXT,
|
||||
`link` VARCHAR(512) NOT NULL DEFAULT \'\',
|
||||
`link_text` VARCHAR(128) NOT NULL DEFAULT \'\',
|
||||
`image` VARCHAR(255) NOT NULL DEFAULT \'\',
|
||||
`alert_type` VARCHAR(16) NOT NULL DEFAULT \'info\',
|
||||
`timeout` INT(11) NOT NULL DEFAULT 0,
|
||||
@@ -87,12 +90,24 @@ trait Install
|
||||
);
|
||||
';
|
||||
|
||||
$sqlToExec[] = '
|
||||
CREATE TABLE IF NOT EXISTS ' . _DB_PREFIX_ . 'ws_customhtml_lang (
|
||||
`id_ws_customhtml` INT(11) NOT NULL,
|
||||
`id_lang` INT(11) NOT NULL,
|
||||
`title` VARCHAR(256) NOT NULL DEFAULT \'\',
|
||||
`content` LONGTEXT,
|
||||
`description` TEXT,
|
||||
`extra_description` TEXT,
|
||||
`link` VARCHAR(512) NOT NULL DEFAULT \'\',
|
||||
`link_text` VARCHAR(128) NOT NULL DEFAULT \'\',
|
||||
PRIMARY KEY (`id_ws_customhtml`, `id_lang`)
|
||||
);
|
||||
';
|
||||
|
||||
$sqlToExec[] = '
|
||||
CREATE TABLE IF NOT EXISTS ' . _DB_PREFIX_ . 'ws_customhtml_faq (
|
||||
`id_ws_customhtml_faq` INT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
||||
`id_ws_customhtml` INT(11) NOT NULL,
|
||||
`question` VARCHAR(512) NOT NULL DEFAULT \'\',
|
||||
`answer` TEXT,
|
||||
`ordering` INT(11) NOT NULL DEFAULT 0,
|
||||
`date_add` DATETIME NOT NULL,
|
||||
`date_upd` DATETIME NOT NULL,
|
||||
@@ -100,15 +115,20 @@ trait Install
|
||||
);
|
||||
';
|
||||
|
||||
$sqlToExec[] = '
|
||||
CREATE TABLE IF NOT EXISTS ' . _DB_PREFIX_ . 'ws_customhtml_faq_lang (
|
||||
`id_ws_customhtml_faq` INT(11) NOT NULL,
|
||||
`id_lang` INT(11) NOT NULL,
|
||||
`question` VARCHAR(512) NOT NULL DEFAULT \'\',
|
||||
`answer` TEXT,
|
||||
PRIMARY KEY (`id_ws_customhtml_faq`, `id_lang`)
|
||||
);
|
||||
';
|
||||
|
||||
$sqlToExec[] = '
|
||||
CREATE TABLE IF NOT EXISTS ' . _DB_PREFIX_ . 'ws_customhtml_slide (
|
||||
`id_ws_customhtml_slide` INT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
||||
`id_ws_customhtml` INT(11) NOT NULL,
|
||||
`title` VARCHAR(256) NOT NULL DEFAULT \'\',
|
||||
`description` TEXT,
|
||||
`extra_description` TEXT,
|
||||
`link` VARCHAR(512) NOT NULL DEFAULT \'\',
|
||||
`link_text` VARCHAR(128) NOT NULL DEFAULT \'\',
|
||||
`image` VARCHAR(255) NOT NULL DEFAULT \'\',
|
||||
`ordering` INT(11) NOT NULL DEFAULT 0,
|
||||
`date_add` DATETIME NOT NULL,
|
||||
@@ -117,6 +137,19 @@ trait Install
|
||||
);
|
||||
';
|
||||
|
||||
$sqlToExec[] = '
|
||||
CREATE TABLE IF NOT EXISTS ' . _DB_PREFIX_ . 'ws_customhtml_slide_lang (
|
||||
`id_ws_customhtml_slide` INT(11) NOT NULL,
|
||||
`id_lang` INT(11) NOT NULL,
|
||||
`title` VARCHAR(256) NOT NULL DEFAULT \'\',
|
||||
`description` TEXT,
|
||||
`extra_description` TEXT,
|
||||
`link` VARCHAR(512) NOT NULL DEFAULT \'\',
|
||||
`link_text` VARCHAR(128) NOT NULL DEFAULT \'\',
|
||||
PRIMARY KEY (`id_ws_customhtml_slide`, `id_lang`)
|
||||
);
|
||||
';
|
||||
|
||||
foreach ($sqlToExec as $sqlBlock) {
|
||||
Db::getInstance()->execute(trim($sqlBlock));
|
||||
}
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
<?php
|
||||
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
|
||||
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
|
||||
header('Cache-Control: no-store, no-cache, must-revalidate');
|
||||
header('Cache-Control: post-check=0, pre-check=0', false);
|
||||
header('Pragma: no-cache');
|
||||
header('Location: ../');
|
||||
exit;
|
||||
@@ -0,0 +1,8 @@
|
||||
<?php
|
||||
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
|
||||
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
|
||||
header('Cache-Control: no-store, no-cache, must-revalidate');
|
||||
header('Cache-Control: post-check=0, pre-check=0', false);
|
||||
header('Pragma: no-cache');
|
||||
header('Location: ../');
|
||||
exit;
|
||||
@@ -0,0 +1,8 @@
|
||||
<?php
|
||||
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
|
||||
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
|
||||
header('Cache-Control: no-store, no-cache, must-revalidate');
|
||||
header('Cache-Control: post-check=0, pre-check=0', false);
|
||||
header('Pragma: no-cache');
|
||||
header('Location: ../');
|
||||
exit;
|
||||
@@ -0,0 +1,257 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" version="1.2">
|
||||
<file original="Modules.Wscustomhtml.Admin.xlf" source-language="en" target-language="nl" datatype="plaintext">
|
||||
<body>
|
||||
<trans-unit id="512923e3b931df3400cc06287e7541cc" approved="yes">
|
||||
<source>Custom HTML</source>
|
||||
<target state="final">Aangepaste HTML</target>
|
||||
<note>File: ws_customhtml.php [Line: 39]</note>
|
||||
</trans-unit>
|
||||
<trans-unit id="7831af914461a744912d0579b8bb9d1a" approved="yes">
|
||||
<source>Create and manage custom HTML blocks for frontend hooks.</source>
|
||||
<target state="final">Aangepaste HTML-blokken maken en beheren voor frontend hooks.</target>
|
||||
<note>File: ws_customhtml.php [Line: 40]</note>
|
||||
</trans-unit>
|
||||
<trans-unit id="b78a3223503896721cca1303f776159b" approved="yes">
|
||||
<source>Title</source>
|
||||
<target state="final">Titel</target>
|
||||
<note>File: src/Form/Type/CustomHtmlGroupType.php [Line: 28]</note>
|
||||
</trans-unit>
|
||||
<trans-unit id="26f548bcbdeea5047396db341a10a2bf" approved="yes">
|
||||
<source>Hook name</source>
|
||||
<target state="final">Hooknaam</target>
|
||||
<note>File: src/Form/Type/CustomHtmlGroupType.php [Line: 33]</note>
|
||||
</trans-unit>
|
||||
<trans-unit id="843575e3d0942a474aed722856631ec1" approved="yes">
|
||||
<source>Custom group classes</source>
|
||||
<target state="final">Aangepaste groepsklassen</target>
|
||||
<note>File: src/Form/Type/CustomHtmlGroupType.php [Line: 37]</note>
|
||||
</trans-unit>
|
||||
<trans-unit id="c9339c0b1a199af41f690392077119af" approved="yes">
|
||||
<source>Default block class</source>
|
||||
<target state="final">Standaard blokklasse</target>
|
||||
<note>File: src/Form/Type/CustomHtmlGroupType.php [Line: 42]</note>
|
||||
</trans-unit>
|
||||
<trans-unit id="dee82074a8fdd944350a8ed6ef7000ba" approved="yes">
|
||||
<source>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.</source>
|
||||
<target state="final">Wordt automatisch toegepast op elk blok in deze groep, naast de eigen aangepaste klassen van dat blok. Handig wanneer meerdere blokken dezelfde kolomindeling nodig hebben.</target>
|
||||
<note>File: src/Form/Type/CustomHtmlGroupType.php [Line: 45]</note>
|
||||
</trans-unit>
|
||||
<trans-unit id="4d3d769b812b6faa6b76e1a8abaece2d" approved="yes">
|
||||
<source>Active</source>
|
||||
<target state="final">Actief</target>
|
||||
<note>File: src/Form/Type/CustomHtmlGroupType.php [Line: 48]</note>
|
||||
</trans-unit>
|
||||
<trans-unit id="3c889850381b0603721d568824ecfd18" approved="yes">
|
||||
<source>Custom HTML Groups</source>
|
||||
<target state="final">Aangepaste HTML-groepen</target>
|
||||
<note>File: src/Grid/Definition/Factory/CustomHtmlGroupGridDefinitionFactory.php [Line: 40]</note>
|
||||
</trans-unit>
|
||||
<trans-unit id="b9b371458ab7c314f88b81c553f6ce51" approved="yes">
|
||||
<source>Hook</source>
|
||||
<target state="final">Hook</target>
|
||||
<note>File: src/Grid/Definition/Factory/CustomHtmlGroupGridDefinitionFactory.php [Line: 73]</note>
|
||||
</trans-unit>
|
||||
<trans-unit id="04c4f9f595c4f21d1de65eb07056c15a" approved="yes">
|
||||
<source>Blocks</source>
|
||||
<target state="final">Blokken</target>
|
||||
<note>File: src/Grid/Definition/Factory/CustomHtmlGroupGridDefinitionFactory.php [Line: 78]</note>
|
||||
</trans-unit>
|
||||
<trans-unit id="195a8106bcb998b48a86acb2fee032c5" approved="yes">
|
||||
<source>View blocks</source>
|
||||
<target state="final">Blokken bekijken</target>
|
||||
<note>File: src/Grid/Definition/Factory/CustomHtmlGroupGridDefinitionFactory.php [Line: 156]</note>
|
||||
</trans-unit>
|
||||
<trans-unit id="2ff8071bcd15a31f9a743f1b06d0d00f" approved="yes">
|
||||
<source>Add block</source>
|
||||
<target state="final">Blok toevoegen</target>
|
||||
<note>File: src/Grid/Definition/Factory/CustomHtmlGroupGridDefinitionFactory.php [Line: 166]</note>
|
||||
</trans-unit>
|
||||
<trans-unit id="93ee75bea0afaff1edf1444b1f8d4757" approved="yes">
|
||||
<source>Custom HTML Blocks</source>
|
||||
<target state="final">Aangepaste HTML-blokken</target>
|
||||
<note>File: src/Grid/Definition/Factory/CustomHtmlBlockGridDefinitionFactory.php [Line: 41]</note>
|
||||
</trans-unit>
|
||||
<trans-unit id="03937134cedab9078be39a77ee3a48a0" approved="yes">
|
||||
<source>Group</source>
|
||||
<target state="final">Groep</target>
|
||||
<note>File: src/Form/Type/CustomHtmlBlockType.php [Line: 41]</note>
|
||||
</trans-unit>
|
||||
<trans-unit id="a1fa27779242b4902f7ae3bdd5c6d508" approved="yes">
|
||||
<source>Type</source>
|
||||
<target state="final">Type</target>
|
||||
<note>File: src/Form/Type/CustomHtmlBlockType.php [Line: 47]</note>
|
||||
</trans-unit>
|
||||
<trans-unit id="52f5e0bc3859bc5f5e25130b6c7e8881" approved="yes">
|
||||
<source>Position</source>
|
||||
<target state="final">Positie</target>
|
||||
<note>File: src/Grid/Definition/Factory/CustomHtmlBlockGridDefinitionFactory.php [Line: 89]</note>
|
||||
</trans-unit>
|
||||
<trans-unit id="7c060faccd05262f4901c16573f645a9" approved="yes">
|
||||
<source>Unable to find the group.</source>
|
||||
<target state="final">Kan de groep niet vinden.</target>
|
||||
<note>File: src/Controller/CustomHtmlGroupController.php [Line: 98]</note>
|
||||
</trans-unit>
|
||||
<trans-unit id="d738152dd177b4600836d2db542e8845" approved="yes">
|
||||
<source>Unable to find the block.</source>
|
||||
<target state="final">Kan het blok niet vinden.</target>
|
||||
<note>File: src/Controller/CustomHtmlBlockController.php [Line: 125]</note>
|
||||
</trans-unit>
|
||||
<trans-unit id="b5a812dff3c33b63cf77f0ce007da42e" approved="yes">
|
||||
<source>Block type</source>
|
||||
<target state="final">Bloktype</target>
|
||||
<note>File: src/Form/Type/CustomHtmlBlockType.php [Line: 47]</note>
|
||||
</trans-unit>
|
||||
<trans-unit id="507b7246f245b8935c5aafd81e80c4ee" approved="yes">
|
||||
<source>Show title</source>
|
||||
<target state="final">Titel tonen</target>
|
||||
<note>File: src/Form/Type/CustomHtmlBlockType.php [Line: 59]</note>
|
||||
</trans-unit>
|
||||
<trans-unit id="f15c1cae7882448b3fb0404682e17e61" approved="yes">
|
||||
<source>Content</source>
|
||||
<target state="final">Inhoud</target>
|
||||
<note>File: src/Form/Type/CustomHtmlBlockType.php [Line: 65]</note>
|
||||
</trans-unit>
|
||||
<trans-unit id="be53a0541a6d36f6ecb879fa2c584b08" approved="yes">
|
||||
<source>Image</source>
|
||||
<target state="final">Afbeelding</target>
|
||||
<note>File: src/Form/Type/CustomHtmlBlockType.php [Line: 71]</note>
|
||||
</trans-unit>
|
||||
<trans-unit id="d60bc7c265eb450473afbd22ececda09" approved="yes">
|
||||
<source>Slider mode</source>
|
||||
<target state="final">Slidermodus</target>
|
||||
<note>File: src/Form/Type/CustomHtmlBlockType.php [Line: 92]</note>
|
||||
</trans-unit>
|
||||
<trans-unit id="9e2352975b97b9b49e97dcd80788ed88" approved="yes">
|
||||
<source>"Mobile only": slider only on mobile, a static grid shows instead from tablet up.</source>
|
||||
<target state="final">"Alleen mobiel": slider alleen op mobiel, vanaf tablet wordt in plaats daarvan een statisch raster getoond.</target>
|
||||
<note>File: src/Form/Type/CustomHtmlBlockType.php [Line: 95]</note>
|
||||
</trans-unit>
|
||||
<trans-unit id="0cffdd608d41a4c9c7bac7cf621ca5b9" approved="yes">
|
||||
<source>Slides visible on mobile</source>
|
||||
<target state="final">Zichtbare slides op mobiel</target>
|
||||
<note>File: src/Form/Type/CustomHtmlBlockType.php [Line: 99]</note>
|
||||
</trans-unit>
|
||||
<trans-unit id="35bf3a5e2797e56b2d06b18acaae41f9" approved="yes">
|
||||
<source>Slides visible on tablet</source>
|
||||
<target state="final">Zichtbare slides op tablet</target>
|
||||
<note>File: src/Form/Type/CustomHtmlBlockType.php [Line: 106]</note>
|
||||
</trans-unit>
|
||||
<trans-unit id="40d77e75964dd04ea925f34300dd8b48" approved="yes">
|
||||
<source>Slides visible on desktop</source>
|
||||
<target state="final">Zichtbare slides op desktop</target>
|
||||
<note>File: src/Form/Type/CustomHtmlBlockType.php [Line: 113]</note>
|
||||
</trans-unit>
|
||||
<trans-unit id="06b9281e396db002010bde1de57262eb" approved="yes">
|
||||
<source>Auto</source>
|
||||
<target state="final">Automatisch</target>
|
||||
<note>File: src/Form/Type/CustomHtmlBlockType.php [Line: 116]</note>
|
||||
</trans-unit>
|
||||
<trans-unit id="921048c199ee33279927fc77d2dc213a" approved="yes">
|
||||
<source>In "Mobile only" mode this is rounded to the nearest whole number of columns. Leave empty for an equal-width column.</source>
|
||||
<target state="final">In de modus "Alleen mobiel" wordt dit afgerond naar het dichtstbijzijnde hele aantal kolommen. Laat leeg voor een kolom met gelijke breedte.</target>
|
||||
<note>File: src/Form/Type/CustomHtmlBlockType.php [Line: 117]</note>
|
||||
</trans-unit>
|
||||
<trans-unit id="db03b62817b3b2f4657b679c13bb5b28" approved="yes">
|
||||
<source>Autoplay delay (seconds)</source>
|
||||
<target state="final">Vertraging automatisch afspelen (seconden)</target>
|
||||
<note>File: src/Form/Type/CustomHtmlBlockType.php [Line: 121]</note>
|
||||
</trans-unit>
|
||||
<trans-unit id="ae8c3292c47fef302c93202badd63109" approved="yes">
|
||||
<source>0 means the slider never auto-advances; visitors can still swipe or use the arrows.</source>
|
||||
<target state="final">0 betekent dat de slider nooit automatisch doorschuift; bezoekers kunnen nog wel swipen of de pijlen gebruiken.</target>
|
||||
<note>File: src/Form/Type/CustomHtmlBlockType.php [Line: 124]</note>
|
||||
</trans-unit>
|
||||
<trans-unit id="d479cd75faccc438f93b8b6414a2a329" approved="yes">
|
||||
<source>Alert style</source>
|
||||
<target state="final">Waarschuwingsstijl</target>
|
||||
<note>File: src/Form/Type/CustomHtmlBlockType.php [Line: 128]</note>
|
||||
</trans-unit>
|
||||
<trans-unit id="4527eae2e84aed7a238504cbbf509272" approved="yes">
|
||||
<source>Auto-dismiss after (seconds)</source>
|
||||
<target state="final">Automatisch sluiten na (seconden)</target>
|
||||
<note>File: src/Form/Type/CustomHtmlBlockType.php [Line: 134]</note>
|
||||
</trans-unit>
|
||||
<trans-unit id="e59eb2e617eb720ae30bbf71010a7a97" approved="yes">
|
||||
<source>0 means the alert never auto-dismisses; visitors can still close it manually.</source>
|
||||
<target state="final">0 betekent dat de melding nooit automatisch sluit; bezoekers kunnen deze nog wel handmatig sluiten.</target>
|
||||
<note>File: src/Form/Type/CustomHtmlBlockType.php [Line: 137]</note>
|
||||
</trans-unit>
|
||||
<trans-unit id="b5a7adde1af5c87d7fd797b6245c2a39" approved="yes">
|
||||
<source>Description</source>
|
||||
<target state="final">Beschrijving</target>
|
||||
<note>File: src/Form/Type/CustomHtmlBlockType.php [Line: 142]</note>
|
||||
</trans-unit>
|
||||
<trans-unit id="7cc0fd746c5cec9842dd8d5251ee2352" approved="yes">
|
||||
<source>Extra description</source>
|
||||
<target state="final">Extra beschrijving</target>
|
||||
<note>File: src/Form/Type/CustomHtmlBlockType.php [Line: 149]</note>
|
||||
</trans-unit>
|
||||
<trans-unit id="5e4e1bd6f922fed062b62c446ca34f84" approved="yes">
|
||||
<source>Link URL</source>
|
||||
<target state="final">Link-URL</target>
|
||||
<note>File: src/Form/Type/CustomHtmlBlockType.php [Line: 156]</note>
|
||||
</trans-unit>
|
||||
<trans-unit id="63a11faa3a692d4e00fa8e03bbe8a0d6" approved="yes">
|
||||
<source>Link text</source>
|
||||
<target state="final">Linktekst</target>
|
||||
<note>File: src/Form/Type/CustomHtmlBlockType.php [Line: 163]</note>
|
||||
</trans-unit>
|
||||
<trans-unit id="c15a6ec85c9e2dfc65fde2c60b592564" approved="yes">
|
||||
<source>Custom classes</source>
|
||||
<target state="final">Aangepaste klassen</target>
|
||||
<note>File: src/Form/Type/CustomHtmlBlockType.php [Line: 171]</note>
|
||||
</trans-unit>
|
||||
<trans-unit id="a97ea56b0e00b2379736ae60869ff66a" approved="yes">
|
||||
<source>Question</source>
|
||||
<target state="final">Vraag</target>
|
||||
<note>File: src/Form/Type/CustomHtmlFaqType.php [Line: 24]</note>
|
||||
</trans-unit>
|
||||
<trans-unit id="3751695c17afed4055a7a5ad5d46f6f5" approved="yes">
|
||||
<source>Answer</source>
|
||||
<target state="final">Antwoord</target>
|
||||
<note>File: src/Form/Type/CustomHtmlFaqType.php [Line: 28]</note>
|
||||
</trans-unit>
|
||||
<trans-unit id="c28fc5d6c4a0a5ee47e06d56bab36dec" approved="yes">
|
||||
<source>Custom HTML Block</source>
|
||||
<target state="final">Aangepast HTML-blok</target>
|
||||
<note>File: views/templates/admin/form/blocks/block_form.html.twig [Line: 26]</note>
|
||||
</trans-unit>
|
||||
<trans-unit id="73be1b885def51a0ff0d8905365b3eeb" approved="yes">
|
||||
<source>Current image</source>
|
||||
<target state="final">Huidige afbeelding</target>
|
||||
<note>File: views/templates/admin/form/blocks/block_form.html.twig [Line: 42]</note>
|
||||
</trans-unit>
|
||||
<trans-unit id="4dfb7691cbfd8ee3a0f42018bcb2db65" approved="yes">
|
||||
<source>FAQ items</source>
|
||||
<target state="final">FAQ-items</target>
|
||||
<note>File: views/templates/admin/form/blocks/block_form.html.twig [Line: 50]</note>
|
||||
</trans-unit>
|
||||
<trans-unit id="a4156d4998aa5183e106a57342f7315a" approved="yes">
|
||||
<source>Add FAQ item</source>
|
||||
<target state="final">FAQ-item toevoegen</target>
|
||||
<note>File: views/templates/admin/form/blocks/block_form.html.twig [Line: 70]</note>
|
||||
</trans-unit>
|
||||
<trans-unit id="a8d90ed8f17c347c8d46e0ef22c85ecb" approved="yes">
|
||||
<source>Slides</source>
|
||||
<target state="final">Slides</target>
|
||||
<note>File: views/templates/admin/form/blocks/block_form.html.twig [Line: 76]</note>
|
||||
</trans-unit>
|
||||
<trans-unit id="056f53405bf3cf4bde3731c26d725365" approved="yes">
|
||||
<source>Add slide</source>
|
||||
<target state="final">Slide toevoegen</target>
|
||||
<note>File: views/templates/admin/form/blocks/block_form.html.twig [Line: 96]</note>
|
||||
</trans-unit>
|
||||
<trans-unit id="5ff997cff41cb8eeb86e6e484233a8af" approved="yes">
|
||||
<source>The group that this block belongs to applies the classes "%s%" to every block. Edit the group to change this - it is stored under the "Default block class" input.</source>
|
||||
<target state="final">De groep waartoe dit blok behoort past de klassen "%s%" toe op elk blok. Bewerk de groep om dit te wijzigen - dit wordt opgeslagen onder het veld "Standaard blokklasse".</target>
|
||||
<note>File: views/templates/admin/form/blocks/block_form.html.twig [Line: 118]</note>
|
||||
</trans-unit>
|
||||
<trans-unit id="5973aee626e71dba35de5485ccde9481" approved="yes">
|
||||
<source>Custom HTML Group</source>
|
||||
<target state="final">Aangepaste HTML-groep</target>
|
||||
<note>File: views/templates/admin/form/blocks/group_form.html.twig [Line: 9]</note>
|
||||
</trans-unit>
|
||||
</body>
|
||||
</file>
|
||||
</xliff>
|
||||
@@ -0,0 +1,17 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" version="1.2">
|
||||
<file original="Modules.Wscustomhtml.Shop.xlf" source-language="en" target-language="nl" datatype="plaintext">
|
||||
<body>
|
||||
<trans-unit id="d59048f21fd887ad520398ce677be586" approved="yes">
|
||||
<source>Learn more</source>
|
||||
<target state="final">Meer informatie</target>
|
||||
<note>File: views/templates/hook/_alert.tpl [Line: 20]</note>
|
||||
</trans-unit>
|
||||
<trans-unit id="d3d2e617335f08df83599665eef8a418" approved="yes">
|
||||
<source>Close</source>
|
||||
<target state="final">Sluiten</target>
|
||||
<note>File: views/templates/hook/_alert.tpl [Line: 23]</note>
|
||||
</trans-unit>
|
||||
</body>
|
||||
</file>
|
||||
</xliff>
|
||||
@@ -0,0 +1,8 @@
|
||||
<?php
|
||||
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
|
||||
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
|
||||
header('Cache-Control: no-store, no-cache, must-revalidate');
|
||||
header('Cache-Control: post-check=0, pre-check=0', false);
|
||||
header('Pragma: no-cache');
|
||||
header('Location: ../');
|
||||
exit;
|
||||
@@ -1,31 +0,0 @@
|
||||
<?php
|
||||
|
||||
if (!defined('_PS_VERSION_')) {
|
||||
exit;
|
||||
}
|
||||
|
||||
function upgrade_module_1_10_0($module)
|
||||
{
|
||||
$columnsToAdd = [
|
||||
'alert_type' => 'VARCHAR(16) NOT NULL DEFAULT \'info\'',
|
||||
'timeout' => 'INT(11) NOT NULL DEFAULT 0',
|
||||
];
|
||||
|
||||
foreach ($columnsToAdd as $column => $definition) {
|
||||
$existing = Db::getInstance()->executeS(
|
||||
'SHOW COLUMNS FROM `' . _DB_PREFIX_ . 'ws_customhtml` LIKE \'' . $column . '\''
|
||||
);
|
||||
|
||||
if (!empty($existing)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!Db::getInstance()->execute(
|
||||
'ALTER TABLE `' . _DB_PREFIX_ . 'ws_customhtml` ADD COLUMN `' . $column . '` ' . $definition
|
||||
)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
<?php
|
||||
|
||||
if (!defined('_PS_VERSION_')) {
|
||||
exit;
|
||||
}
|
||||
|
||||
function upgrade_module_1_11_0($module)
|
||||
{
|
||||
$groups = Db::getInstance()->executeS(
|
||||
'SELECT `id_ws_customhtml_group` FROM `' . _DB_PREFIX_ . 'ws_customhtml_group` ORDER BY `id_ws_customhtml_group` ASC'
|
||||
);
|
||||
|
||||
foreach ($groups as $index => $group) {
|
||||
if (!Db::getInstance()->update(
|
||||
'ws_customhtml_group',
|
||||
['ordering' => (int) $index],
|
||||
'`id_ws_customhtml_group` = ' . (int) $group['id_ws_customhtml_group']
|
||||
)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -1,21 +0,0 @@
|
||||
<?php
|
||||
|
||||
if (!defined('_PS_VERSION_')) {
|
||||
exit;
|
||||
}
|
||||
|
||||
function upgrade_module_1_13_0($module)
|
||||
{
|
||||
$existing = Db::getInstance()->executeS(
|
||||
'SHOW COLUMNS FROM `' . _DB_PREFIX_ . 'ws_customhtml_group` LIKE \'custom_class\''
|
||||
);
|
||||
|
||||
if (!empty($existing)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return Db::getInstance()->execute(
|
||||
'ALTER TABLE `' . _DB_PREFIX_ . 'ws_customhtml_group`
|
||||
ADD COLUMN `custom_class` VARCHAR(128) NOT NULL DEFAULT \'\' AFTER `title`'
|
||||
);
|
||||
}
|
||||
@@ -1,21 +0,0 @@
|
||||
<?php
|
||||
|
||||
if (!defined('_PS_VERSION_')) {
|
||||
exit;
|
||||
}
|
||||
|
||||
function upgrade_module_1_15_0($module)
|
||||
{
|
||||
$existing = Db::getInstance()->executeS(
|
||||
'SHOW COLUMNS FROM `' . _DB_PREFIX_ . 'ws_customhtml` LIKE \'link_text\''
|
||||
);
|
||||
|
||||
if (!empty($existing)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return Db::getInstance()->execute(
|
||||
'ALTER TABLE `' . _DB_PREFIX_ . 'ws_customhtml`
|
||||
ADD COLUMN `link_text` VARCHAR(128) NOT NULL DEFAULT \'\' AFTER `link`'
|
||||
);
|
||||
}
|
||||
@@ -1,48 +0,0 @@
|
||||
<?php
|
||||
|
||||
if (!defined('_PS_VERSION_')) {
|
||||
exit;
|
||||
}
|
||||
|
||||
function upgrade_module_1_16_0($module)
|
||||
{
|
||||
$columnsToAdd = [
|
||||
'slides_per_view_mobile' => 'DECIMAL(4,2) NOT NULL DEFAULT 1',
|
||||
'slides_per_view_tablet' => 'DECIMAL(4,2) NOT NULL DEFAULT 2',
|
||||
'slides_per_view_desktop' => 'DECIMAL(4,2) NOT NULL DEFAULT 3',
|
||||
'autoplay_delay' => 'INT(11) NOT NULL DEFAULT 0',
|
||||
];
|
||||
|
||||
foreach ($columnsToAdd as $column => $definition) {
|
||||
$existing = Db::getInstance()->executeS(
|
||||
'SHOW COLUMNS FROM `' . _DB_PREFIX_ . 'ws_customhtml` LIKE \'' . $column . '\''
|
||||
);
|
||||
|
||||
if (!empty($existing)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!Db::getInstance()->execute(
|
||||
'ALTER TABLE `' . _DB_PREFIX_ . 'ws_customhtml` ADD COLUMN `' . $column . '` ' . $definition
|
||||
)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return Db::getInstance()->execute(
|
||||
'CREATE TABLE IF NOT EXISTS `' . _DB_PREFIX_ . 'ws_customhtml_slide` (
|
||||
`id_ws_customhtml_slide` INT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
||||
`id_ws_customhtml` INT(11) NOT NULL,
|
||||
`title` VARCHAR(256) NOT NULL DEFAULT \'\',
|
||||
`description` TEXT,
|
||||
`extra_description` TEXT,
|
||||
`link` VARCHAR(512) NOT NULL DEFAULT \'\',
|
||||
`link_text` VARCHAR(128) NOT NULL DEFAULT \'\',
|
||||
`image` VARCHAR(255) NOT NULL DEFAULT \'\',
|
||||
`ordering` INT(11) NOT NULL DEFAULT 0,
|
||||
`date_add` DATETIME NOT NULL,
|
||||
`date_upd` DATETIME NOT NULL,
|
||||
KEY `id_ws_customhtml` (`id_ws_customhtml`)
|
||||
)'
|
||||
);
|
||||
}
|
||||
@@ -1,21 +0,0 @@
|
||||
<?php
|
||||
|
||||
if (!defined('_PS_VERSION_')) {
|
||||
exit;
|
||||
}
|
||||
|
||||
function upgrade_module_1_17_0($module)
|
||||
{
|
||||
$existing = Db::getInstance()->executeS(
|
||||
'SHOW COLUMNS FROM `' . _DB_PREFIX_ . 'ws_customhtml` LIKE \'slider_mode\''
|
||||
);
|
||||
|
||||
if (!empty($existing)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return Db::getInstance()->execute(
|
||||
'ALTER TABLE `' . _DB_PREFIX_ . 'ws_customhtml`
|
||||
ADD COLUMN `slider_mode` VARCHAR(16) NOT NULL DEFAULT \'always\' AFTER `timeout`'
|
||||
);
|
||||
}
|
||||
@@ -1,38 +0,0 @@
|
||||
<?php
|
||||
|
||||
if (!defined('_PS_VERSION_')) {
|
||||
exit;
|
||||
}
|
||||
|
||||
function upgrade_module_1_2_0($module)
|
||||
{
|
||||
$columns = Db::getInstance()->executeS(
|
||||
'SHOW COLUMNS FROM `' . _DB_PREFIX_ . 'ws_customhtml` LIKE \'type\''
|
||||
);
|
||||
|
||||
if (empty($columns)) {
|
||||
if (!Db::getInstance()->execute(
|
||||
'ALTER TABLE `' . _DB_PREFIX_ . 'ws_customhtml`
|
||||
ADD COLUMN `type` VARCHAR(32) NOT NULL DEFAULT \'html\' AFTER `title`'
|
||||
)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (!Db::getInstance()->execute(
|
||||
'CREATE TABLE IF NOT EXISTS `' . _DB_PREFIX_ . 'ws_customhtml_faq` (
|
||||
`id_ws_customhtml_faq` INT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
||||
`id_ws_customhtml` INT(11) NOT NULL,
|
||||
`question` VARCHAR(512) NOT NULL DEFAULT \'\',
|
||||
`answer` TEXT,
|
||||
`ordering` INT(11) NOT NULL DEFAULT 0,
|
||||
`date_add` DATETIME NOT NULL,
|
||||
`date_upd` DATETIME NOT NULL,
|
||||
KEY `id_ws_customhtml` (`id_ws_customhtml`)
|
||||
)'
|
||||
)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return $module->registerHook('actionCustomhtmlblockGridDataModifier');
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
<?php
|
||||
|
||||
if (!defined('_PS_VERSION_')) {
|
||||
exit;
|
||||
}
|
||||
|
||||
function upgrade_module_1_3_0($module)
|
||||
{
|
||||
$columns = Db::getInstance()->executeS(
|
||||
'SHOW COLUMNS FROM `' . _DB_PREFIX_ . 'ws_customhtml` LIKE \'column_class\''
|
||||
);
|
||||
|
||||
if (empty($columns)) {
|
||||
if (!Db::getInstance()->execute(
|
||||
'ALTER TABLE `' . _DB_PREFIX_ . 'ws_customhtml`
|
||||
ADD COLUMN `column_class` VARCHAR(128) NOT NULL DEFAULT \'col-12\' AFTER `content`'
|
||||
)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
<?php
|
||||
|
||||
if (!defined('_PS_VERSION_')) {
|
||||
exit;
|
||||
}
|
||||
|
||||
function upgrade_module_1_4_0($module)
|
||||
{
|
||||
if (!Hook::isModuleRegisteredOnHook($module, 'actionFrontControllerSetMedia', (int) Context::getContext()->shop->id)) {
|
||||
return $module->registerHook('actionFrontControllerSetMedia');
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -1,32 +0,0 @@
|
||||
<?php
|
||||
|
||||
if (!defined('_PS_VERSION_')) {
|
||||
exit;
|
||||
}
|
||||
|
||||
function upgrade_module_1_5_0($module)
|
||||
{
|
||||
$newColumn = Db::getInstance()->executeS(
|
||||
'SHOW COLUMNS FROM `' . _DB_PREFIX_ . 'ws_customhtml` LIKE \'custom_class\''
|
||||
);
|
||||
|
||||
if (!empty($newColumn)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
$oldColumn = Db::getInstance()->executeS(
|
||||
'SHOW COLUMNS FROM `' . _DB_PREFIX_ . 'ws_customhtml` LIKE \'column_class\''
|
||||
);
|
||||
|
||||
if (!empty($oldColumn)) {
|
||||
return Db::getInstance()->execute(
|
||||
'ALTER TABLE `' . _DB_PREFIX_ . 'ws_customhtml`
|
||||
CHANGE `column_class` `custom_class` VARCHAR(128) NOT NULL DEFAULT \'\''
|
||||
);
|
||||
}
|
||||
|
||||
return Db::getInstance()->execute(
|
||||
'ALTER TABLE `' . _DB_PREFIX_ . 'ws_customhtml`
|
||||
ADD COLUMN `custom_class` VARCHAR(128) NOT NULL DEFAULT \'\' AFTER `content`'
|
||||
);
|
||||
}
|
||||
@@ -1,34 +0,0 @@
|
||||
<?php
|
||||
|
||||
if (!defined('_PS_VERSION_')) {
|
||||
exit;
|
||||
}
|
||||
|
||||
function upgrade_module_1_6_0($module)
|
||||
{
|
||||
$columnsToAdd = [
|
||||
'description' => 'TEXT',
|
||||
'extra_description' => 'TEXT',
|
||||
'link' => 'VARCHAR(512) NOT NULL DEFAULT \'\'',
|
||||
'template' => 'VARCHAR(32) NOT NULL DEFAULT \'image_left\'',
|
||||
'image' => 'VARCHAR(255) NOT NULL DEFAULT \'\'',
|
||||
];
|
||||
|
||||
foreach ($columnsToAdd as $column => $definition) {
|
||||
$existing = Db::getInstance()->executeS(
|
||||
'SHOW COLUMNS FROM `' . _DB_PREFIX_ . 'ws_customhtml` LIKE \'' . $column . '\''
|
||||
);
|
||||
|
||||
if (!empty($existing)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!Db::getInstance()->execute(
|
||||
'ALTER TABLE `' . _DB_PREFIX_ . 'ws_customhtml` ADD COLUMN `' . $column . '` ' . $definition
|
||||
)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
<?php
|
||||
|
||||
if (!defined('_PS_VERSION_')) {
|
||||
exit;
|
||||
}
|
||||
|
||||
function upgrade_module_1_7_0($module)
|
||||
{
|
||||
$existing = Db::getInstance()->executeS(
|
||||
'SHOW COLUMNS FROM `' . _DB_PREFIX_ . 'ws_customhtml` LIKE \'template\''
|
||||
);
|
||||
|
||||
if (empty($existing)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return Db::getInstance()->execute(
|
||||
'ALTER TABLE `' . _DB_PREFIX_ . 'ws_customhtml` DROP COLUMN `template`'
|
||||
);
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
<?php
|
||||
|
||||
if (!defined('_PS_VERSION_')) {
|
||||
exit;
|
||||
}
|
||||
|
||||
function upgrade_module_1_8_0($module)
|
||||
{
|
||||
$existing = Db::getInstance()->executeS(
|
||||
'SHOW COLUMNS FROM `' . _DB_PREFIX_ . 'ws_customhtml` LIKE \'template_key\''
|
||||
);
|
||||
|
||||
if (!empty($existing)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return Db::getInstance()->execute(
|
||||
'ALTER TABLE `' . _DB_PREFIX_ . 'ws_customhtml` ADD COLUMN `template_key` VARCHAR(64) NOT NULL DEFAULT \'\''
|
||||
);
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
<?php
|
||||
|
||||
if (!defined('_PS_VERSION_')) {
|
||||
exit;
|
||||
}
|
||||
|
||||
function upgrade_module_1_9_0($module)
|
||||
{
|
||||
$existing = Db::getInstance()->executeS(
|
||||
'SHOW COLUMNS FROM `' . _DB_PREFIX_ . 'ws_customhtml` LIKE \'template_key\''
|
||||
);
|
||||
|
||||
if (empty($existing)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return Db::getInstance()->execute(
|
||||
'ALTER TABLE `' . _DB_PREFIX_ . 'ws_customhtml` DROP COLUMN `template_key`'
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
<?php
|
||||
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
|
||||
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
|
||||
header('Cache-Control: no-store, no-cache, must-revalidate');
|
||||
header('Cache-Control: post-check=0, pre-check=0', false);
|
||||
header('Pragma: no-cache');
|
||||
header('Location: ../');
|
||||
exit;
|
||||
@@ -7,6 +7,7 @@
|
||||
padding: 2rem;
|
||||
bottom: 0px;
|
||||
position: absolute;
|
||||
z-index: 2;
|
||||
}
|
||||
|
||||
.customhtml-banner-title {
|
||||
@@ -18,13 +19,16 @@
|
||||
margin-bottom: 1rem;
|
||||
}
|
||||
|
||||
/* .customhtml-banner-image--gradient {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
.customhtml-banner-image {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.customhtml-banner-image--gradient {
|
||||
position: absolute;
|
||||
background: transparent linear-gradient(180deg, #27272777 0%, #272727 100%)
|
||||
0% 0% no-repeat padding-box;
|
||||
} */
|
||||
inset: 0;
|
||||
pointer-events: none;
|
||||
z-index: 1;
|
||||
}
|
||||
/* Alert */
|
||||
.customhtml-alert {
|
||||
max-height: 500px;
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
<?php
|
||||
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
|
||||
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
|
||||
header('Cache-Control: no-store, no-cache, must-revalidate');
|
||||
header('Cache-Control: post-check=0, pre-check=0', false);
|
||||
header('Pragma: no-cache');
|
||||
header('Location: ../');
|
||||
exit;
|
||||
@@ -0,0 +1,8 @@
|
||||
<?php
|
||||
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
|
||||
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
|
||||
header('Cache-Control: no-store, no-cache, must-revalidate');
|
||||
header('Cache-Control: post-check=0, pre-check=0', false);
|
||||
header('Pragma: no-cache');
|
||||
header('Location: ../');
|
||||
exit;
|
||||
@@ -0,0 +1,8 @@
|
||||
<?php
|
||||
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
|
||||
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
|
||||
header('Cache-Control: no-store, no-cache, must-revalidate');
|
||||
header('Cache-Control: post-check=0, pre-check=0', false);
|
||||
header('Pragma: no-cache');
|
||||
header('Location: ../');
|
||||
exit;
|
||||
@@ -0,0 +1,8 @@
|
||||
<?php
|
||||
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
|
||||
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
|
||||
header('Cache-Control: no-store, no-cache, must-revalidate');
|
||||
header('Cache-Control: post-check=0, pre-check=0', false);
|
||||
header('Pragma: no-cache');
|
||||
header('Location: ../');
|
||||
exit;
|
||||
@@ -1,6 +1,8 @@
|
||||
$(document).ready(function () {
|
||||
window.prestashop.component.initComponents([
|
||||
'TinyMCEEditor',
|
||||
'TranslatableField',
|
||||
'TranslatableInput',
|
||||
]);
|
||||
|
||||
function toggleBlockTypeFields() {
|
||||
@@ -18,6 +20,20 @@ $(document).ready(function () {
|
||||
$('#custom_html_block_type').on('change', toggleBlockTypeFields);
|
||||
toggleBlockTypeFields();
|
||||
|
||||
function toggleGroupDefaultClassHint() {
|
||||
var hint = $('#customhtmlblock-group-default-class-hint');
|
||||
var defaultClass = $('#custom_html_block_id_ws_customhtml_group option:selected').data('defaultBlockClass');
|
||||
|
||||
if (defaultClass) {
|
||||
hint.text(hint.data('template').replace('%s%', defaultClass)).show();
|
||||
} else {
|
||||
hint.hide();
|
||||
}
|
||||
}
|
||||
|
||||
$('#custom_html_block_id_ws_customhtml_group').on('change', toggleGroupDefaultClassHint);
|
||||
toggleGroupDefaultClassHint();
|
||||
|
||||
function initRepeater(containerSelector, addButtonSelector, itemClass, removeButtonClass) {
|
||||
var container = $(containerSelector);
|
||||
var removeLabel = container.data('removeLabel');
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
$(document).ready(function () {
|
||||
window.prestashop.component.initComponents([
|
||||
'TranslatableField',
|
||||
'TranslatableInput',
|
||||
]);
|
||||
});
|
||||
@@ -0,0 +1,8 @@
|
||||
<?php
|
||||
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
|
||||
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
|
||||
header('Cache-Control: no-store, no-cache, must-revalidate');
|
||||
header('Cache-Control: post-check=0, pre-check=0', false);
|
||||
header('Pragma: no-cache');
|
||||
header('Location: ../');
|
||||
exit;
|
||||
@@ -0,0 +1,8 @@
|
||||
<?php
|
||||
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
|
||||
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
|
||||
header('Cache-Control: no-store, no-cache, must-revalidate');
|
||||
header('Cache-Control: post-check=0, pre-check=0', false);
|
||||
header('Pragma: no-cache');
|
||||
header('Location: ../');
|
||||
exit;
|
||||
@@ -0,0 +1,8 @@
|
||||
<?php
|
||||
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
|
||||
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
|
||||
header('Cache-Control: no-store, no-cache, must-revalidate');
|
||||
header('Cache-Control: post-check=0, pre-check=0', false);
|
||||
header('Pragma: no-cache');
|
||||
header('Location: ../');
|
||||
exit;
|
||||
@@ -109,17 +109,20 @@
|
||||
{{ form_row(customHtmlBlockForm.timeout) }}
|
||||
{{ form_row(customHtmlBlockForm.description) }}
|
||||
{{ form_row(customHtmlBlockForm.extra_description) }}
|
||||
<div class="row">
|
||||
{{ form_row(customHtmlBlockForm.link) }}
|
||||
{{ form_row(customHtmlBlockForm.link_text) }}
|
||||
</div>
|
||||
{{ form_row(customHtmlBlockForm.link) }}
|
||||
{{ form_row(customHtmlBlockForm.link_text) }}
|
||||
|
||||
<p
|
||||
id="customhtmlblock-group-default-class-hint"
|
||||
class="alert alert-warning"
|
||||
data-template="{{ 'The group that this block belongs to applies the classes "%s%" to every block. Edit the group to change this - it is stored under the "Default block class" input.'|trans({}, 'Modules.Wscustomhtml.Admin')|e('html_attr') }}"
|
||||
></p>
|
||||
{{ form_row(customHtmlBlockForm.custom_class) }}
|
||||
{{ form_row(customHtmlBlockForm.active) }}
|
||||
{{ form_rest(customHtmlBlockForm) }}
|
||||
</div>
|
||||
<div class="card-footer">
|
||||
<a href="{{ path('customhtmlblock_index') }}" class="btn btn-outline-secondary">
|
||||
<a href="{{ path('customhtmlblock_index', idGroup is defined and idGroup ? {'idGroup': idGroup} : {}) }}" class="btn btn-outline-secondary">
|
||||
{{ 'Cancel'|trans({}, 'Admin.Actions') }}
|
||||
</a>
|
||||
<button class="btn btn-primary float-right">
|
||||
|
||||
@@ -17,6 +17,9 @@
|
||||
{{ 'Cancel'|trans({}, 'Admin.Actions') }}
|
||||
</a>
|
||||
{% if idCustomHtmlGroup is defined %}
|
||||
<a href="{{ path('customhtmlblock_index', {'idGroup': idCustomHtmlGroup}) }}" class="btn btn-outline-primary">
|
||||
{{ 'View blocks'|trans({}, 'Modules.Wscustomhtml.Admin') }}
|
||||
</a>
|
||||
<a href="{{ path('customhtmlblock_create', {'idGroup': idCustomHtmlGroup}) }}" class="btn btn-outline-primary">
|
||||
{{ 'Add block'|trans({}, 'Modules.Wscustomhtml.Admin') }}
|
||||
</a>
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
<?php
|
||||
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
|
||||
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
|
||||
header('Cache-Control: no-store, no-cache, must-revalidate');
|
||||
header('Cache-Control: post-check=0, pre-check=0', false);
|
||||
header('Pragma: no-cache');
|
||||
header('Location: ../');
|
||||
exit;
|
||||
@@ -5,3 +5,8 @@
|
||||
{% include '@Modules/ws_customhtml/views/templates/admin/form/blocks/group_form.html.twig' %}
|
||||
{% endblock %}
|
||||
{% endblock %}
|
||||
|
||||
{% block javascripts %}
|
||||
{{ parent() }}
|
||||
<script src="{{ asset('../modules/ws_customhtml/views/js/admin/customhtmlgroup_form.js') }}"></script>
|
||||
{% endblock %}
|
||||
|
||||
@@ -5,3 +5,8 @@
|
||||
{% include '@Modules/ws_customhtml/views/templates/admin/form/blocks/group_form.html.twig' %}
|
||||
{% endblock %}
|
||||
{% endblock %}
|
||||
|
||||
{% block javascripts %}
|
||||
{{ parent() }}
|
||||
<script src="{{ asset('../modules/ws_customhtml/views/js/admin/customhtmlgroup_form.js') }}"></script>
|
||||
{% endblock %}
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
<?php
|
||||
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
|
||||
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
|
||||
header('Cache-Control: no-store, no-cache, must-revalidate');
|
||||
header('Cache-Control: post-check=0, pre-check=0', false);
|
||||
header('Pragma: no-cache');
|
||||
header('Location: ../');
|
||||
exit;
|
||||
@@ -12,5 +12,6 @@
|
||||
|
||||
{% block javascripts %}
|
||||
{{ parent() }}
|
||||
<script src="{{ asset('themes/default/js/bundle/pagination.js') }}"></script>
|
||||
<script src="{{ asset('../modules/ws_customhtml/views/js/admin/customhtmlblock_grid.js') }}"></script>
|
||||
{% endblock %}
|
||||
|
||||
@@ -12,5 +12,6 @@
|
||||
|
||||
{% block javascripts %}
|
||||
{{ parent() }}
|
||||
<script src="{{ asset('themes/default/js/bundle/pagination.js') }}"></script>
|
||||
<script src="{{ asset('../modules/ws_customhtml/views/js/admin/customhtmlgroup_grid.js') }}"></script>
|
||||
{% endblock %}
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
<?php
|
||||
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
|
||||
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
|
||||
header('Cache-Control: no-store, no-cache, must-revalidate');
|
||||
header('Cache-Control: post-check=0, pre-check=0', false);
|
||||
header('Pragma: no-cache');
|
||||
header('Location: ../');
|
||||
exit;
|
||||
@@ -0,0 +1,8 @@
|
||||
<?php
|
||||
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
|
||||
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
|
||||
header('Cache-Control: no-store, no-cache, must-revalidate');
|
||||
header('Cache-Control: post-check=0, pre-check=0', false);
|
||||
header('Pragma: no-cache');
|
||||
header('Location: ../');
|
||||
exit;
|
||||
@@ -1,21 +1,30 @@
|
||||
{if !empty($block.description)}
|
||||
<div
|
||||
id="customhtml-alert-{$block.id_ws_customhtml|intval}"
|
||||
class="alert alert-{$block.alert_type|escape:'html':'UTF-8'} alert-dismissible customhtml-alert"
|
||||
role="alert"
|
||||
data-timeout="{$block.timeout|intval}"
|
||||
>
|
||||
{if $block.show_title && !empty($block.title)}
|
||||
<strong class="customhtml-alert-title">{$block.title|escape:'html':'UTF-8'}</strong>
|
||||
{/if}
|
||||
<span class="customhtml-alert-text">{$block.description|escape:'html':'UTF-8'|nl2br}</span>
|
||||
{if !empty($block.link)}
|
||||
<a href="{$block.link|escape:'html':'UTF-8'}" class="btn btn-{$block.alert_type|escape:'html':'UTF-8'} customhtml-alert-btn">
|
||||
{if !empty($block.link_text)}{$block.link_text|escape:'html':'UTF-8'}{else}{l s='Learn more' d='Modules.Wscustomhtml.Shop'}{/if}
|
||||
</a>
|
||||
{/if}
|
||||
<button type="button" class="close customhtml-alert-close" aria-label="{l s='Close' d='Modules.Wscustomhtml.Shop'}">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
<div class="row">
|
||||
{block name=alert_content}
|
||||
<div class="col d-flex align-items-center">
|
||||
{if $block.show_title && !empty($block.title)}
|
||||
<strong class="customhtml-alert-title">{$block.title|escape:'html':'UTF-8'}</strong>
|
||||
{/if}
|
||||
<span class="customhtml-alert-text">{$block.description|escape:'html':'UTF-8'|nl2br}</span>
|
||||
</div>
|
||||
{/block}
|
||||
{block name=alert_actions}
|
||||
<div class="col-auto">
|
||||
{if !empty($block.link)}
|
||||
<a href="{$block.link|escape:'html':'UTF-8'}" class="btn btn-{$block.alert_type|escape:'html':'UTF-8'} customhtml-alert-btn">
|
||||
{if !empty($block.link_text)}{$block.link_text|escape:'html':'UTF-8'}{else}{l s='Learn more' d='Modules.Wscustomhtml.Shop'}{/if}
|
||||
</a>
|
||||
{/if}
|
||||
<button type="button" class="close customhtml-alert-close" aria-label="{l s='Close' d='Modules.Wscustomhtml.Shop'}">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
{/block}
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
@@ -1,23 +1,38 @@
|
||||
<div class="customhtml-banner row flex-column position-relative">
|
||||
<div class="customhtml-banner-image">
|
||||
<div class="customhtml-banner-image--gradient"></div>
|
||||
{if !empty($block.image_url)}
|
||||
<img src="{$block.image_url|escape:'html':'UTF-8'}" alt="{$block.title|escape:'html':'UTF-8'}">
|
||||
{else}
|
||||
<img
|
||||
src="{$urls.img_ps_url}noimageavailable.jpg"
|
||||
alt="{$block.title|escape:'html':'UTF-8'}"
|
||||
width="100%"
|
||||
class="img-fluid rounded lazyload"
|
||||
/>
|
||||
{/if}
|
||||
</div>
|
||||
{block name=banner_image}
|
||||
<div class="customhtml-banner-image">
|
||||
<div class="customhtml-banner-image--gradient"></div>
|
||||
{if !empty($block.image_url)}
|
||||
<img src="{$block.image_url|escape:'html':'UTF-8'}" alt="{$block.title|escape:'html':'UTF-8'}">
|
||||
{else}
|
||||
<img
|
||||
src="{$urls.img_ps_url}noimageavailable.jpg"
|
||||
alt="{$block.title|escape:'html':'UTF-8'}"
|
||||
width="100%"
|
||||
class="img-fluid rounded lazyload"
|
||||
/>
|
||||
{/if}
|
||||
</div>
|
||||
{/block}
|
||||
{block name=banner_content}
|
||||
<div class="customhtml-banner-content">
|
||||
{assign var="customhtmlOverridePath" value="{$smarty.const._PS_THEME_DIR_}modules/ws_customhtml/views/templates/hook/{$hookName}/_banner_content.tpl"}
|
||||
{if file_exists($customhtmlOverridePath)}
|
||||
{include file="module:ws_customhtml/views/templates/hook/`$hookName`/_banner_content.tpl" block=$block}
|
||||
{else}
|
||||
{include file="module:ws_customhtml/views/templates/hook/_banner_content.tpl" block=$block}
|
||||
{if !empty($count)}
|
||||
<span class="customhtml-banner-count font-monospace">{$count}</span>
|
||||
{/if}
|
||||
{if $block.show_title && !empty($block.title)}
|
||||
<h3 class="customhtml-banner-title">{$block.title|escape:'html':'UTF-8'}</h3>
|
||||
{/if}
|
||||
{if !empty($block.description)}
|
||||
<div class="customhtml-banner-description">{$block.description|escape:'html':'UTF-8'|nl2br}</div>
|
||||
{/if}
|
||||
{if !empty($block.extra_description)}
|
||||
<div class="customhtml-banner-extra-description">{$block.extra_description|escape:'html':'UTF-8'|nl2br}</div>
|
||||
{/if}
|
||||
{if !empty($block.link)}
|
||||
<a href="{$block.link|escape:'html':'UTF-8'}" class="btn btn-primary customhtml-banner-link">
|
||||
{if !empty($block.link_text)}{$block.link_text|escape:'html':'UTF-8'}{else}{l s='Learn more' d='Modules.Wscustomhtml.Shop'}{/if}
|
||||
</a>
|
||||
{/if}
|
||||
</div>
|
||||
{/block}
|
||||
</div>
|
||||
@@ -1,14 +0,0 @@
|
||||
{if $block.show_title && !empty($block.title)}
|
||||
<h3 class="customhtml-banner-title">{$block.title|escape:'html':'UTF-8'}</h3>
|
||||
{/if}
|
||||
{if !empty($block.description)}
|
||||
<div class="customhtml-banner-description">{$block.description|escape:'html':'UTF-8'|nl2br}</div>
|
||||
{/if}
|
||||
{if !empty($block.extra_description)}
|
||||
<div class="customhtml-banner-extra-description">{$block.extra_description|escape:'html':'UTF-8'|nl2br}</div>
|
||||
{/if}
|
||||
{if !empty($block.link)}
|
||||
<a href="{$block.link|escape:'html':'UTF-8'}" class="btn btn-primary customhtml-banner-link">
|
||||
{if !empty($block.link_text)}{$block.link_text|escape:'html':'UTF-8'}{else}{l s='Learn more' d='Modules.Wscustomhtml.Shop'}{/if}
|
||||
</a>
|
||||
{/if}
|
||||
@@ -2,8 +2,9 @@
|
||||
<div class="accordion customhtml-faq-accordion" id="customhtml-faq-{$block.id_ws_customhtml|intval}">
|
||||
{foreach from=$block.faqs item="faq" name="customhtmlFaqLoop"}
|
||||
<div class="card">
|
||||
{block name=faq_question}
|
||||
<div class="card-header" id="customhtml-faq-heading-{$block.id_ws_customhtml|intval}-{$faq.id_ws_customhtml_faq|intval}">
|
||||
|
||||
|
||||
{if !empty($faq.answer)}
|
||||
<button
|
||||
class="btn btn-link col-12 d-flex text-left{if !$smarty.foreach.customhtmlFaqLoop.first} collapsed{/if}"
|
||||
@@ -14,7 +15,7 @@
|
||||
aria-controls="customhtml-faq-collapse-{$block.id_ws_customhtml|intval}-{$faq.id_ws_customhtml_faq|intval}"
|
||||
>
|
||||
{/if}
|
||||
|
||||
|
||||
<div class="faq-question col pl-0">
|
||||
{$faq.question|escape:'html':'UTF-8'}
|
||||
</div>
|
||||
@@ -39,7 +40,9 @@
|
||||
{/if}
|
||||
|
||||
</div>
|
||||
{/block}
|
||||
{if !empty($faq.answer)}
|
||||
{block name=faq_answer}
|
||||
<div
|
||||
id="customhtml-faq-collapse-{$block.id_ws_customhtml|intval}-{$faq.id_ws_customhtml_faq|intval}"
|
||||
class="collapse{if $smarty.foreach.customhtmlFaqLoop.first} show{/if}"
|
||||
@@ -50,6 +53,7 @@
|
||||
{$faq.answer nofilter}
|
||||
</div>
|
||||
</div>
|
||||
{/block}
|
||||
{/if}
|
||||
</div>
|
||||
{/foreach}
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
{extends file="module:ws_customhtml/views/templates/hook/_banner.tpl"}
|
||||
@@ -2,15 +2,16 @@
|
||||
{if $block.slider_mode == 'responsive'}
|
||||
{block name=slider_responsive}
|
||||
<div class="d-lg-none">
|
||||
<div id="customhtml-slider-{$block.id_ws_customhtml|intval}" class="swiper customhtml-slider" data-swiper="{$block.slider_config|escape:'html':'UTF-8'}">
|
||||
<div class="swiper customhtml-slider" data-swiper="{$block.slider_config|escape:'html':'UTF-8'}">
|
||||
<div class="swiper-wrapper">
|
||||
{foreach from=$block.slides item="slide" name="slides"}
|
||||
{assign var="count" value=$smarty.foreach.slides.iteration|string_format:"%02d"}
|
||||
<div class="swiper-slide">
|
||||
{assign var="customhtmlOverridePath" value="{$smarty.const._PS_THEME_DIR_}modules/ws_customhtml/views/templates/hook/{$hookName}/banner.tpl"}
|
||||
{assign var="customhtmlOverridePath" value="{$smarty.const._PS_THEME_DIR_}modules/ws_customhtml/views/templates/hook/{$hookName}/slide.tpl"}
|
||||
{if file_exists($customhtmlOverridePath)}
|
||||
{include file="module:ws_customhtml/views/templates/hook/`$hookName`/banner.tpl" block=$slide group=$group hookName=$hookName}
|
||||
{include file="module:ws_customhtml/views/templates/hook/`$hookName`/slide.tpl" block=$slide group=$group hookName=$hookName count=$count}
|
||||
{else}
|
||||
{include file="module:ws_customhtml/views/templates/hook/_banner.tpl" block=$slide}
|
||||
{include file="module:ws_customhtml/views/templates/hook/_slide.tpl" block=$slide count=$count}
|
||||
{/if}
|
||||
</div>
|
||||
{/foreach}
|
||||
@@ -19,12 +20,17 @@
|
||||
</div>
|
||||
<div class="row d-none d-lg-flex customhtml-slider-grid">
|
||||
{foreach from=$block.slides item="slide" name="slides"}
|
||||
{assign var="count" value=$smarty.foreach.slides.iteration|string_format:"%02d"}
|
||||
{if !empty($block.slider_desktop_column_width)}
|
||||
<div class="customhtml-slider-grid-item" style="flex: 0 0 {$block.slider_desktop_column_width|escape:'html':'UTF-8'}; max-width: {$block.slider_desktop_column_width|escape:'html':'UTF-8'};">
|
||||
{assign var="customhtmlOverridePath" value="{$smarty.const._PS_THEME_DIR_}modules/ws_customhtml/views/templates/hook/{$hookName}/banner.tpl"}
|
||||
{else}
|
||||
<div class="customhtml-slider-grid-item col">
|
||||
{/if}
|
||||
{assign var="customhtmlOverridePath" value="{$smarty.const._PS_THEME_DIR_}modules/ws_customhtml/views/templates/hook/{$hookName}/slide.tpl"}
|
||||
{if file_exists($customhtmlOverridePath)}
|
||||
{include file="module:ws_customhtml/views/templates/hook/`$hookName`/banner.tpl" block=$slide group=$group hookName=$hookName}
|
||||
{include file="module:ws_customhtml/views/templates/hook/`$hookName`/slide.tpl" block=$slide group=$group hookName=$hookName count=$count}
|
||||
{else}
|
||||
{include file="module:ws_customhtml/views/templates/hook/_banner.tpl" block=$slide}
|
||||
{include file="module:ws_customhtml/views/templates/hook/_slide.tpl" block=$slide count=$count}
|
||||
{/if}
|
||||
</div>
|
||||
{/foreach}
|
||||
@@ -33,15 +39,16 @@
|
||||
{/if}
|
||||
{if $block.slider_mode != 'responsive'}
|
||||
{block name=slider_always}
|
||||
<div id="customhtml-slider-{$block.id_ws_customhtml|intval}" class="swiper customhtml-slider" data-swiper="{$block.slider_config|escape:'html':'UTF-8'}">
|
||||
<div class="swiper customhtml-slider" data-swiper="{$block.slider_config|escape:'html':'UTF-8'}">
|
||||
<div class="swiper-wrapper">
|
||||
{foreach from=$block.slides item="slide" name="slides"}
|
||||
{assign var="count" value=$smarty.foreach.slides.iteration|string_format:"%02d"}
|
||||
<div class="swiper-slide">
|
||||
{assign var="customhtmlOverridePath" value="{$smarty.const._PS_THEME_DIR_}modules/ws_customhtml/views/templates/hook/{$hookName}/banner.tpl"}
|
||||
{assign var="customhtmlOverridePath" value="{$smarty.const._PS_THEME_DIR_}modules/ws_customhtml/views/templates/hook/{$hookName}/slide.tpl"}
|
||||
{if file_exists($customhtmlOverridePath)}
|
||||
{include file="module:ws_customhtml/views/templates/hook/`$hookName`/banner.tpl" block=$slide group=$group hookName=$hookName}
|
||||
{include file="module:ws_customhtml/views/templates/hook/`$hookName`/slide.tpl" block=$slide group=$group hookName=$hookName count=$count}
|
||||
{else}
|
||||
{include file="module:ws_customhtml/views/templates/hook/_banner.tpl" block=$slide}
|
||||
{include file="module:ws_customhtml/views/templates/hook/_slide.tpl" block=$slide count=$count}
|
||||
{/if}
|
||||
</div>
|
||||
{/foreach}
|
||||
@@ -50,5 +57,3 @@
|
||||
{/block}
|
||||
{/if}
|
||||
{/if}
|
||||
|
||||
|
||||
|
||||
@@ -1,17 +1,24 @@
|
||||
{if !empty($block.image_url) || ($block.show_title && !empty($block.title))}
|
||||
{if !empty($block.image_url) || ($block.show_title && !empty($block.title)) || !empty($block.description)}
|
||||
{if !empty($block.link)}
|
||||
<a href="{$block.link|escape:'html':'UTF-8'}" class="customhtml-usp d-flex align-items-center">
|
||||
{else}
|
||||
<div class="customhtml-usp d-flex align-items-center">
|
||||
{/if}
|
||||
{block name=usp_icon}
|
||||
{if !empty($block.image_url)}
|
||||
<span class="customhtml-usp-icon">
|
||||
<img src="{$block.image_url|escape:'html':'UTF-8'}" alt="">
|
||||
</span>
|
||||
{/if}
|
||||
{/block}
|
||||
{block name=usp_content}
|
||||
{if $block.show_title && !empty($block.title)}
|
||||
<span class="customhtml-usp-text">{$block.title|escape:'html':'UTF-8'}</span>
|
||||
{/if}
|
||||
{if !empty($block.description)}
|
||||
<span class="customhtml-usp-description">{$block.description|escape:'html':'UTF-8'|nl2br}</span>
|
||||
{/if}
|
||||
{/block}
|
||||
{if !empty($block.link)}
|
||||
</a>
|
||||
{else}
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
{if !empty($groupList)}
|
||||
<div class="customhtml-container {$hookName|escape:'html':'UTF-8'}--container">
|
||||
{foreach from=$groupList item="group"}
|
||||
<div class="customhtml-group customhtml-group-{$group.id_ws_customhtml_group|intval} row{if !empty($group.custom_class)} {$group.custom_class|escape:'html':'UTF-8'}{/if}">
|
||||
{foreach from=$group.blocks item="block"}
|
||||
<div class="customhtml-block col{if !empty($block.custom_class)} {$block.custom_class|escape:'html':'UTF-8'}{/if}">
|
||||
<div class="customhtml-group row{if !empty($group.custom_class)} {$group.custom_class|escape:'html':'UTF-8'}{/if}">
|
||||
{foreach from=$group.blocks item="block" name="blocks"}
|
||||
<div class="customhtml-block col{if !empty($group.default_block_class)} {$group.default_block_class|escape:'html':'UTF-8'}{/if}{if !empty($block.custom_class)} {$block.custom_class|escape:'html':'UTF-8'}{/if}">
|
||||
{assign var="customhtmlOverridePath" value="{$smarty.const._PS_THEME_DIR_}modules/ws_customhtml/views/templates/hook/{$hookName}/{$block.type}.tpl"}
|
||||
|
||||
{if file_exists($customhtmlOverridePath)}
|
||||
{include file="module:ws_customhtml/views/templates/hook/`$hookName`/`$block.type`.tpl" block=$block group=$group hookName=$hookName}
|
||||
{include file="module:ws_customhtml/views/templates/hook/`$hookName`/`$block.type`.tpl" block=$block group=$group hookName=$hookName iteration=$smarty.foreach.blocks.iteration}
|
||||
{elseif $block.type == 'faq'}
|
||||
{if $block.show_title && !empty($block.title)}
|
||||
<div class="customhtml-title">{$block.title|escape:'html':'UTF-8'}</div>
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
<?php
|
||||
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
|
||||
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
|
||||
header('Cache-Control: no-store, no-cache, must-revalidate');
|
||||
header('Cache-Control: post-check=0, pre-check=0', false);
|
||||
header('Pragma: no-cache');
|
||||
header('Location: ../');
|
||||
exit;
|
||||
@@ -0,0 +1,8 @@
|
||||
<?php
|
||||
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
|
||||
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
|
||||
header('Cache-Control: no-store, no-cache, must-revalidate');
|
||||
header('Cache-Control: post-check=0, pre-check=0', false);
|
||||
header('Pragma: no-cache');
|
||||
header('Location: ../');
|
||||
exit;
|
||||
+1
-1
@@ -29,7 +29,7 @@ class Ws_CustomHtml extends Module implements WidgetInterface
|
||||
public function __construct()
|
||||
{
|
||||
$this->name = 'ws_customhtml';
|
||||
$this->version = '1.17.0';
|
||||
$this->version = '1.24.0';
|
||||
$this->author = 'Isabelle Oving-Anno | De Websmid BV';
|
||||
$this->need_instance = 0;
|
||||
$this->bootstrap = true;
|
||||
|
||||
Reference in New Issue
Block a user