How to make dynamic label (from field) in blueprint?

I am using builder plugin. It’s possible to wrap fieldsets, but then only label of that fieldset is visible, so if I have for example 10 fieldsets, and all are wrapped, all would show something like “event”, “event” … Would be nicer to show one of fields (title), that is inside that fieldset:

This is probably better placed on the plugins Github repository, since it’s probably a job for @timoetting

Hey. There is already an issue for that. I am planning to implement this feature within the next week.

4 Likes

Great, thank you!

@timoetting, are there any news about this feature?

Hey,

please check out the latest version. The fieldsets now have the option name, which takes over the role of the old label option, i.e. being used as a text for the add-new-fieldset-buttons and the headers of the fieldset blocks.

You can, however, override the header text by using the, now optional, label option. You can use 'mustache` syntax to include any field value of the respective fieldset.

Example

[...]
fieldsets:
  quote: 
    name: Quote
    label: Quote by {{citation}}
    preview:
      snippet: blocks/quote
      css: /assets/css/blocks/quote.csstab preselected.
    fields:
      text:
        label: Quote Text
        type: textarea
      citation:
        label: Citation
        type: text
[...]

This will result in an add button like this:

35

and a fieldset header like this:

2 Likes

Very nice, thank you. Will add, that if there is no text before or after brackets, like in your example (“Quote by”) - label: {{citation}}, it won’t print anything, but it works like this: label: '{{citation}}'.

Also maybe it’s possible to strip text to cetrain number of symbols? As sometimes it can be a field group with only textarea, so would be nice to see the beginning of text in that case.

Looks great, thank you!! I know I’ll use this right away and my clients will love it too.

1 Like