From 6aff506cd68f43cdc75453ef432b08e85776b594 Mon Sep 17 00:00:00 2001 From: Isabelle Date: Tue, 23 Jun 2026 13:13:51 +0200 Subject: [PATCH] feat(main): conform to Websmid module standards --- src/Module/AdminHooks.php | 7 +++++++ src/Module/{FrontHooks.php => DisplayHooks.php} | 2 +- ws_customhtml.php | 9 ++------- 3 files changed, 10 insertions(+), 8 deletions(-) rename src/Module/{FrontHooks.php => DisplayHooks.php} (98%) diff --git a/src/Module/AdminHooks.php b/src/Module/AdminHooks.php index e005555..94afaa6 100644 --- a/src/Module/AdminHooks.php +++ b/src/Module/AdminHooks.php @@ -2,10 +2,17 @@ namespace Websmid\CustomHtml\Module; +use Tools; + trait AdminHooks { public function isUsingNewTranslationSystem(): bool { return true; } + + public function getContent() + { + Tools::redirectAdmin($this->get('router')->generate('customhtml_index')); + } } diff --git a/src/Module/FrontHooks.php b/src/Module/DisplayHooks.php similarity index 98% rename from src/Module/FrontHooks.php rename to src/Module/DisplayHooks.php index ba91b89..6f17817 100644 --- a/src/Module/FrontHooks.php +++ b/src/Module/DisplayHooks.php @@ -5,7 +5,7 @@ namespace Websmid\CustomHtml\Module; use Websmid\CustomHtml\Model\CustomHtml; use Context; -trait FrontHooks +trait DisplayHooks { public function renderWidget($hookName = null, array $configuration = []) { diff --git a/ws_customhtml.php b/ws_customhtml.php index 016c27c..453033c 100644 --- a/ws_customhtml.php +++ b/ws_customhtml.php @@ -9,7 +9,7 @@ use Websmid\CustomHtml\Module\Install; use Websmid\CustomHtml\Module\AdminHooks; -use Websmid\CustomHtml\Module\FrontHooks; +use Websmid\CustomHtml\Module\DisplayHooks; use PrestaShop\PrestaShop\Core\Module\WidgetInterface; if (!defined('_PS_VERSION_')) { @@ -24,7 +24,7 @@ class Ws_CustomHtml extends Module implements WidgetInterface { use Install; use AdminHooks; - use FrontHooks; + use DisplayHooks; public function __construct() { @@ -40,9 +40,4 @@ class Ws_CustomHtml extends Module implements WidgetInterface $this->description = $this->trans('Create and manage custom HTML blocks for frontend hooks.', [], 'Modules.Wscustomhtml.Admin'); $this->ps_versions_compliancy = ['min' => '1.7.0.0', 'max' => _PS_VERSION_]; } - - public function getContent() - { - Tools::redirectAdmin($this->get('router')->generate('customhtml_index')); - } }