Important!!!!!! A Problem When Creating Your Own Addons - Question | JoomShaper
SP Page Builder 6 is Here! Learn More →

Important!!!!!! A Problem When Creating Your Own Addons

Dmitry Goncharov

Dmitry Goncharov

SP Page Builder 3 years ago

A problem when creating your own addons. In the file site.php the render() function works, but getTemplate() does not work. Both functions work if the addon is located in the components/com_sp page builder/addons folder. Only render() works in the plugin folder. At the same time, the text from the front part ceases to be edited, only in a pop-up window. This problem can be seen and tested in the plugin Demo https://github.com/zareen-fatema/custom-addon

2
6 Answers
Dmitry Goncharov
Dmitry Goncharov
Accepted Answer
2 years ago #89894

Is there any information?

0
Toufiq
Toufiq
Accepted Answer
Senior Staff 2 years ago #90576

Hi there,

Thanks for contacting us. Sorry for the inconvenience. I need to share your query with our developer team. Allow me time please.

-Thanks

0
‏‏‎ ‎J‏‏‎‎e‏‎‏‏‎‎n‏‏‎‎s W.‏‏‎
‏‏‎ ‎J‏‏‎‎e‏‎‏‏‎‎n‏‏‎‎s W.‏‏‎
Accepted Answer
2 years ago #90591

@Toufiq and @Dmitry you can ignore my message, I only want to follow this conversation. Unfortunately there is no function to follow a thread without replying.

0
Toufiq
Toufiq
Accepted Answer
Senior Staff 2 years ago #90659

Please use the latest version of Page Builder and make sure that you have download the plugin from the blog post. Thanks

0
A
Alvaro
Accepted Answer
3 months ago #196961

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.

1
J
Julian
Accepted Answer
2 months ago #201604

Push.

The developers urgently need to do something about this! Is there a different approach to create custom addons for PB 5 or is this https://www.joomshaper.com/blog/how-to-create-custom-addon-in-sp-page-builder-4 still current?

I got another issue. that the changes are not saved in the custom add-on. If you reload the page -> the old values are loaded.

0