Paint Layout Conditional Keywords


(Paul Hutchins) #1

Hi All,

I’m in the process of bringing content with metadata already applied into a new site, and having it only display if the new metadata is not populated. This was going well until I attempted to replicate the settings of the old metadata schema to retain consistency for content editors.

The older metadata schema uses Paintlayout conditional keywords to hide the asset set as default in the field. It is set to a folder to make it easier for editors to find when creating creating a new news item.
This is the code used in the old site for that:
%begin_member_condition%

%asset_metadata_Member_asset_name%,
%else_member_condition%
%end_member_condition%

I’ve replicated the settings in the new site/metadata schema but it’s failing when I try to combine my original working code that shows the old metadata if the new is not populated and the additional condition keyword to hide the set default asset. Are there any obvious issues in the following code?

 %begin_asset_metadata_MemberName%
    %begin_condition_2%
    %asset_metadata_MemberName_asset_name%,
    %else_condition_2%
    %end_condition_2%,
%else_asset%
%asset_metadata_Member_asset_name%,
%end_asset_metadata_MemberName%

Here are the settings for the condition:

Cheers,
Paul


(Iain Simmons) #2

Hi @Paul.Hutchins,

I’m not sure I’m following, but if MemberName and Member are both Related Asset Metadata Fields, then I would suggest using the following keywords and modifiers (^as_asset:asset_name) to get the asset name of the selected assets:

%begin_asset_metadata_MemberName%
    %begin_condition_2%
        %asset_metadata_MemberName^as_asset:asset_name%,
    %end_condition_2%,
%else_asset%
    %asset_metadata_Member^as_asset:asset_name%,
%end_asset_metadata_MemberName%

And of course, check that the asset ID you’re matching, 188031 is the correct one for the new site. If these are in the same Matrix system, then just check that the users have the same permissions applied.

Cheers,
iain


(Paul Hutchins) #3

Hi Iain,
Thanks for taking the time to reply.

I’ve switched out the keywords and modifiers ( I was using the others as that’s what was working in the old site) and still no luck with either the metadata Member or MemberName displaying when I attempt to include condition_2.

The asset ID is correct and in the same system, it pulls in the asset name when the condition is not included.

I might resort to using a select list in the new site instead of a related asset if I can’t resolve the issue.

Cheers,
Paul


(Paul Hutchins) #4

After a lot of trial and error I discovered stripping the code right back produced the desired result.

%begin_condition_2%
       %asset_metadata_MemberName^as_asset:asset_name%,
 %else_condition_2%
        %asset_metadata_Member^as_asset:asset_name%,
 %end_condition_2%

This may be useful for someone at some point.