Hi everyone,
Should I be able to use a global metadata keyword as a conditional keyword in a paint layout?
I've got a comment form nested into a paint layout, but I only want it to show when the metadata for 'Allow Comments' is set to Yes.
I can't put the conditional keyword onto this paint layout, because conditional keywords don't work across divs, and the comment asset builder comes in as a nested content.
So, my plan is to have another paint layout that is applied where the comment asset builder gets nested in, and that will have a conditional keyword on it, so it will only display the comment form if the metadata is 'yes'.
On this paint layout, outputting %asset_metadata_Allow_Comments% doesn't work, instead I use %globals_asset_metadata_Allow_Comments% and it outputs 'yes'.
But how do I set that global keyword in my conditional keywords? All the ways I've tried don't work.
In the dropdown I can select 'globals_asset' and I've then tried added 'metadata_Allow_Comments' and 'metadata Allow Comments' and 'metadata_Allow Comments' but none of them output my conditional content.
Can you use global metadata values in a conditional keywork, and if so, whats the syntax?!
Thanks everyone,
Charlie.
Hi Charlie
There are 2 ways to do this
1 use JavaScript to show or hide the div based on your metadata
2 Wait until you get your upgrade to the latest version and you can use %asset_contents:xxxxx% - this is definitely the best way
Dave
PS before you ask Australia was Awesome
Hi Dave,
I almost didn't ask about Oz, as Im sure it was Awesome! Can't wait to hear the stories from the conference.
Shame that you can't use global keywords… might look at using at putting the asset builder into a snippet, and using keywords on the main paint layout, if not then a bit of javascript maybe to hide it.
Upgrade will be great, but I've got 4 more migrations to go until I can do that!
Cheers,
C.
The design show_if -> keyword_regexp can print the form on condition. http://manuals.matrix.squizsuite.net/designs/chapters/show-if-design-area/
Hi Robin,
That looks great - a nice simple way to achieve exactly what I need to do.
Hadn't thought about the design area.
Big thanks!
C.
Just thought I'd update the thread with the results of trying to use the Design area suggestion:
It does work, but you need to NOT customise it (or at least not in my version of Matrix) because the customisation screen doesn't have the asset_metadata option for the keyword condition. But leave it uncustomised, works a treat!
Thanks,
C.