soflyy/breakdance-bugs

Reusable Dependencies not retrieving

Opened this issue · 1 comments

See comment below with solution


  • Breakdance version: 1.7
  • Browser & OS: Chrome (latest stable), Windows 11
  • If you receive any kind of error message, you should also provide your PHP and WordPress version: PHP 8.1.23, WP 6.4.2

Steps to reproduce:

  • Create custom elements plugin per Element Studio instructions and dev docs
  • Within the plugin, filter breakdance reusable dependencies_urls as follows (redacted with fake url etc for privacy reasons):

add_filter( 'breakdance_reusable_dependencies_urls', [$this, 'my_function'], PHP_INT_MAX ); function gravitydance_gf_styles($urls) { $urls['my_url'] = plugins_url('/assets/js/script.js', 'myplugin/myplugin.php'); return $urls; }

  • Add the dependency in an element in Element Studio using %%BREAKDANCE_REUSABLE_MY_URL%%

Result:
image
image

So it turns out it's the underscore in my dependency key - perhaps the docs need to be updated to explain that the key can't contain an underscore (I'm assuming you explode the string by the underscores to get the key)