soflyy / breakdance-bugs

Bug reports from Breakdance users.
42 stars 6 forks source link

Element Studio custom twig var in dependencies url #475

Open MrBushid0 opened 2 years ago

MrBushid0 commented 2 years ago

A couple of things that would probably only be useful to add-on devs but it would really help, especially #1

  1. Ability to to add custom twig vars similar to %%BREAKDANCE_ELEMENTS_PLUGIN_URL%% for use in the elements studio dependencies url field. The default renderer has the default var hardcoded, maybe add another generic one with string replace to /wp-content instead of the bd dir ?

  2. Ability to add dependencies to the existing list of available ones ( the list with swiper, gsap etc )

a-dubiel commented 2 years ago

Ability to to add custom twig vars similar to %%BREAKDANCE_ELEMENTS_PLUGIN_URL%%

Please be more specific. What variables would you like to have implemented?

Ability to add dependencies to the existing list of available ones ( the list with swiper, gsap etc )

You can do that. Either hardcode the URL in the Element Studio (dependencies tab) or create a new folder with your plugin files in /wp-content/plugins/breakdance/subplugins/breakdance-elements/dependencies-files

MrBushid0 commented 2 years ago

Ability to to add custom twig vars similar to %%BREAKDANCE_ELEMENTS_PLUGIN_URL%%

Please be more specific. What variables would you like to have implemented?

Hi,

I'm referring to the string var %%BREAKDANCE_ELEMENTS_PLUGIN_URL%% that can be used in the url field of dependencies and that gets replaced by the value of the PHP constant BREAKDANCE_ELEMENTS_PLUGIN_URL in the renderer.php.

Yes we can hardcode urls but this is only feasible when working on the same site and not when installing the plugin on different websites.

The quick fix for now is editing the element.php and using a php constant instead. It works fine for both extensions and elements of course, but in the case of elements, the url will get overwritten every time an element is edited and saved via the Element Studio.

Ideally there should be an additional string var ( eg: %%WP_CONTENT_URL%% ) that points to the wp_content dir and a string replace in replaceBreakdancePluginUrlInDependencies() similar to what's done for %%BREAKDANCE_ELEMENTS_PLUGIN_URL%%

Ability to add dependencies to the existing list of available ones ( the list with swiper, gsap etc )

You can do that. Either hardcode the URL in the Element Studio (dependencies tab) or create a new folder with your plugin files in /wp-content/plugins/breakdance/subplugins/breakdance-elements/dependencies-files

Wouldn't that just get overwritten with every BD update?

a-dubiel commented 2 years ago

Wouldn't that just get overwritten with every BD update?

Correct. I was wrong about that. In fact, modifying anything inside the breakdance folder is not recommended.

Ideally there should be an additional string var ( eg: %%WP_CONTENT_URL%% ) that points to the wp_content dir

I will pass this along to our engineering team.

MrBushid0 commented 2 years ago

@a-dubiel Thank you!

artur-burkalo commented 1 year ago

This would be great addition for creators of elements to load scripts and styles with a custom twig code/string that gets the URL of a current plugin of where the elements are.

This is one essential feature I am missing inside element studio.