Passing Attributes to Global Block Instance

Is there a way to pass attributes or properties to a Global Block element from where it’s being instantiated?
This would make Global Blocks incredibly powerful as we could essentially pass variables to them (think props in modern front-end frameworks).

Hello Steven,

Thanks for writing in!

You can make use of the Dynamic Content in an element which can be added in a global block. This feature was being introduced in version Pro 2.5, X theme 6.5 and Cornerstone 3.5. Check out the changelog here:

Hope this helps.

Dynamic content is a really cool addition but I don’t think it helps here.

To illustrate the problem:
Currently I can create say a custom button and save it as a Global Block.
Now I can use that Global Block element anywhere.
What I want to do, for example, is to use the button element on multiple pages but with different text content.
I want to be able to set that text content right where I implement an instance of the Global Block.

Possible solution:
Give us an interface to enter key-value pairs in the Global Block Cornerstone controller (where we select the Global Block from the dropdown)
Following the element-scoped CSS syntax, give us a scoped $el variable in the global block javascript where $el is an object holding the key-value pairs passed to an instance from the cornerstone controller.
For convenience it would be nice if we could add {{ interpolators }} as known from html templating languages anywhere we can enter text in an element.

For example in a Content Area Element that is saved as a Global Block;
<button> {{ $el.text }} </button>
Now a different value for the “text” property can be passed to the Global Block from every instance.

Would love to see something like this in a future version of Cornerstone.

Hello Steven,

We certainly appreciate the feedback! This is something we can add to our list of feature requests. This way it can be taken into consideration for future development. All of these items are discussed with our team internally and prioritized based on the amount of interest a particular feature might receive.

Thanks!

Sweet, thank you so much!
I’m sure this is something many users would LOVE.

You are most welcome!

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.