Zen Cart Logo
Forums / Zen Cart Code Suggestions / Plugin Architecture

Plugin Architecture

Views: 34

Results 1 to 1 of 1
20 Jul 2021, 16:36
#1
niccol avatar

niccol

Totally Zenned

Join Date:
Apr 2009
Posts:
2,138
Plugin Contributions:
1

Plugin Architecture

First, the plugin architecture is a great step in the right direction and I know that we are looking forward to it covering the catalogue as well as just admin
:smile:

It would be nice if the enable/disable function that is included allowed customisation by some sort of hook. So, one way of doing this would be to call a specifically named function from the Installer class of the plugin. So, in a plugin you have the class ScriptedInstaller which has methods "executeInstall" and "executeUninstall". Perhaps we could also have a "enablePlugin" and a "disablePlugin" method that would be called from the BasePluginInstaller class.

The particular thing that made me think of this is a plugin that conditionally adds javascript to the store front. If I disable the plugin from the plugin manager the javascript on the front is still there. What I need to be able to do is hook into the 'disable' feature that is included in the new system and do some custom stuff (in my case, simply disable the module in the module's own settings) Otherwise I am having to write conditionals in the store front that lookup the plugin status and act accordingly. Any module with extensive actions on the store front is going to have the same problem.