File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2525class ModuleHandler
2626{
2727 /**
28- * isModuleEnabled
29- *
3028 * @param string $moduleName
3129 *
3230 * @return bool
@@ -47,12 +45,27 @@ public function isModuleEnabled($moduleName)
4745 return false ;
4846 }
4947
50- return $ module -> registerHook ( ' displayHome ' ) ;
48+ return true ;
5149 }
5250
5351 /**
54- * uninstallModule
52+ * @param string $moduleName
53+ * @param string $hookName
5554 *
55+ * @return bool
56+ */
57+ public function isModuleEnabledAndHookedOn ($ moduleName , $ hookName )
58+ {
59+ $ module = Module::getInstanceByName ($ moduleName );
60+
61+ if (false === $ this ->isModuleEnabled ($ moduleName )) {
62+ return false ;
63+ }
64+
65+ return $ module ->isRegisteredInHook ($ hookName );
66+ }
67+
68+ /**
5669 * @param string $moduleName
5770 *
5871 * @return bool
Original file line number Diff line number Diff line change @@ -53,7 +53,7 @@ public function run()
5353 $ gaScripts = '' ;
5454
5555 // Home featured products
56- if ($ moduleHandler ->isModuleEnabled ('ps_featuredproducts ' )) {
56+ if ($ moduleHandler ->isModuleEnabledAndHookedOn ('ps_featuredproducts ' , ' displayHome ' )) {
5757 $ category = new Category ($ this ->context ->shop ->getCategory (), $ this ->context ->language ->id );
5858 $ productWrapper = new ProductWrapper ($ this ->context );
5959 $ homeFeaturedProducts = $ productWrapper ->wrapProductList (
You can’t perform that action at this time.
0 commit comments