How can you use a block list or block grid settings model property in a label in v16?

hey out there, we’re in the process of upgrading a v13 site to v16

we’ve run into a problem trying to convert this angular code that’s being used in a block list label:

{{title}} {{$settings.hide == '1' ? '(hidden)' : ''}}

the title is simple, that becomes:

{umbValue:title}

the challenge is the $settings.hidevalue - there just doesn’t seem to be a way to access any of the settings model properties?

we’ve tried things like:


{umbValue:settings.hide}
{umbValue:$settings.hide}
{umbValue:settings:hide}
{settings:umbValue:hide}

but nothing works…

has anyone out there managed to do something like this?!?! would :heart: to hear from you if you have :wink:

1 Like

Please try using this to use setting property
{{$settings?.hide ? '(hidden)' : ''}}

hi, thank you for the reply :+1:

sadly no… i think that would work in v13 but not in v16, it outputs as:

Hi Jake, there’s good and bad news.

Bad news is that in versions v14-16.1, there isn’t a built-in way to do this. It would require developing a custom UFM component to retrieve the Block’s settings data.

Good news is that in v16.2, support for Block Settings data has been added to UFM. Along with this, there is an advanced UFM syntax that can do JS-like expressions, (pretty much how AngularJS expressions worked). The syntax would be like this: ${ $settings.hide ? '(hidden)' : '' }.

A release candidate of v16.2.0 is currently out, and the final release will be this Thursday (4th Sept).

2 Likes

Thanks Lee,

I have tried the same in RC v16.2.0 and its working fine as expected.

@leekelleher that is excellent news! we’ll drop the rc in now and update to v16.2.0 this thursday :wink:

thank you for the reply, as always, it’s most appreciated :high-5-you-rock:

2 Likes