Global keyword not recognised for as_asset modifier in Online Quiz asset type


(Tim Davison) #1

I get an error when I try to set a metadata field to use the global site keyword with the as_asset modifier.  Only happens for Online Quiz asset types, all other asset types I've tested work fine.

 

What I'm trying to do:

I'm trying to get my assets to use a default metadata value based on the current site being viewed.

 

My keywords:

%globals_site_assetid^as_asset:asset_metadata_xxx%

Result (error):

On all asset types except Online Quiz, this works absolutely fine.  When I apply it to an Online Quix type, it says:

MySource Warning
File: 	[SYSTEM_ROOT]/core/include/locale_manager.inc 	Line: 	547
Message: 	Assetid, '%globals_site_assetid%', provided to as_asset keyword modifier is not valid [CORE0321]
Backtrace: 	Show

If I use the following keyword alone it works fine (well, prints out the correct ID):

%globals_site_assetid%

Similarly, if I put both these keywords into the page body, asset_id alone works fine, but using ^as_asset on it does not print anything.

 

Any idea why this only fails for Online Quiz types?

 

Update: Matrix v4.12


(Nic Hubbard) #2

Since you would know what the asset ID of the site asset is, couldn't you just do %globals_asset_metadata_xxx:1234% instead? I think it would be an easy work around.


(Tim Davison) #3

Yep, could do, but I'm using global metadata schemas across multiple sites in the same instance, so I want to be able to say to the asset "use the metadata defined as the default for your site, whatever site that may be at this point in time".  I don't want to have to manually tell the asset what site it is, especially as this may change.

 

Additionally, I'd like for some assets (eg copyright notices, privacy notices, etc) to be linked across several sites.  In these cases, they will have the same content, but will display some of their metadata values based on the site defaults relative to the site currently being visited.  

 

e.g.

www.site-a.com/privacy will have metadata DC.Publisher as "The corporation of Site A Pty Ltd"

www.site-b.com/privacy will have metadata DC.Publisher as "Site B Conglomerate Inc."

 

The privacy page has exact same content, linked between sites, but the metadata is dynamically driven, and changes based on the site being visited.  Obviously not suitable for all metadata fields, but for some metadata fields it's very appropriate.

 

All this is working fine, except for Online Quizzes.  Easy solution/workaround is simply exclude Online Quizzes (or include a trigger to clear them on creation) and fill them manually as you've suggested (there's few enough of them on our sites that this would be trivial), but wanted to see if there was a reason anyone knew of why this asset type can't handle the globals keyword when all the others can.


#4

Hey Tim,

 

        Did you ever found a solution for doing this ?

%globals_site_assetid^as_asset:asset_metadata_xxx%

My requirements are similar .... I have posted my question here, but no answers so far ?

 

BTW, I am applying this to a "JSON Data Source" asset type.

 

Cheers ...!