Odd behaviour with contexts


(Hopkinsd1) #1

Hey,

 

I'm currently experiencing some odd behaviour with contexts of a paint layout.  I am using Squiz version 4.16.0.

 

I have two contexts, English and Welsh.

 

Within the paint layout I have condition checks to make sure English content is displayed on the Welsh version if no Welsh is supplied such as this -

 

English context %begin_asset_metadata_profile.biography%

%asset_metadata_profile.biography%
%end_asset_metadata_profile.biography%

Welsh context

  %begin_asset_metadata_profile.biography^context:Welsh%
    <div id="tab-bio" class="tab-pane active">%asset_metadata_profile.biography^context:Welsh%</div>
  %else_asset_metadata_profile.biography^context:Welsh%
    %begin_asset_metadata_profile.biography^context:English%
      <div id="tab-bio" class="tab-pane active">%asset_metadata_profile.biography^context:English%</div>
    %end_asset_metadata_profile.biography^context:English%
  %end_asset_metadata_profile.biography^context:Welsh%

I think these are fairly standard.

 

However the odd behaviour I am seeing is that when I save the English context of the paint layout the asset it is applied to only displays correctly when viewing it in English, the Welsh version is incorrect and reflects an earlier version of the paint layout. If I then save the Welsh context the Welsh version works correctly and is up to date while the English version is incorrect and reflects an earlier version. This process is just looped so I can never get both the English and Welsh contexts to work correctly.

 

Any ideas what may be happening here?

 

Thanks

David


(Bart Banda) #2

When you are within the welsh context, you shouldn't need to add the context modifier to the begin and else keywords as you are already testing it on the Welsh version of that metadata value right?

So can't you just use it like this in the Welsh context:

%begin_asset_metadata_profile.biography%
  <div id="tab-bio" class="tab-pane active">%asset_metadata_profile.biography%</div>
%else_asset_metadata_profile.biography%
  %begin_asset_metadata_profile.biography^context:English%
    <div id="tab-bio" class="tab-pane active">%asset_metadata_profile.biography^context:English%</div>
  %end_asset_metadata_profile.biography^context:English%
%end_asset_metadata_profile.biography%

If that doesn't work, and you are printing this via a paint layout, and your context is based on the URL, maybe you can use URL based conditions to conditionally print the English and Welsh metadata?