Hi, I'm reviving this thread to see if a solution can be found after 2 years to the problem that the getTemplate()
method doesn't work for plugin addons.
I did some research and found that the method_exists
function in the components\com_sppagebuilder\views\form\tmpl\edit.php file, line 333, can't find the getTemplate()
method for plugin addons. This is because the classes don't exist because they haven't been preloaded like the component addons and templates are.
This leads us to review the components\com_sppagebuilder\parser\addon-parser.php file. In this file, the getAddons()
method preloads the addon classes for both the component and the template, but it doesn't exist for the plugin. You can improve here. I also found a quick fix in thegetAddonPath()
method: modify the plugins section, which is 109 to 112 lines, and change the following code:
if (isset($plugins[$addon_name]) && $plugins[$addon_name])
{
return $plugins[$addon_name];
}
to:
if (isset($plugins[$addon_name]) && $plugins[$addon_name])
{
$plg_addon_name = $plugins[$addon_name];
if (file_exists($plg_addon_name . '/site.php')) {
require_once $plg_addon_name . '/site.php';
}
return $plg_addon_name;
}
Please, I'd like to know if you're going to fix this. I've worked on several add-ons from a template. I created the plugin to centralize the addons, and I was surprised to find that the getTemplate()
method doesn't work for addons that are in plugins. Again, I need to know if you're going to fix this or not.
Thank you.