Asset Listing keyword: as_asset not working on root_nodes for Type Formats

Hi all

 

I have an asset listing that I'm calling where I pass a root node dynamic parameter (I'm only passing in a single root node).  Then in the output I want to show the name for the root node I'm using on every row (the output generates a table).

 

I tried to use the following:

%root_nodes^as_asset:asset_name%

If the above keyword is used in the Asset Listing's Page Contents bodycopy, it prints it out perfectly, no issues.  However, if I use the same keyword in the same asset listing but instead in the Default Type Format bodycopy, it just prints out the root node asset ID (basically as if I'd just gone %root_nodes% - the as_asset part doesn't seem to be getting recognised/processed.

 

Something I'm doing wrong?  We are on Matrix v4.12.  Bug in this version?

 

Cheers

This page, I'm afraid, seems to confirm that this isn't a bug:

 

http://manuals.matrix.squizsuite.net/asset-listing/appendices/keyword-replacements

 

%root_nodes% is only listed in the page contents section, not the type formats one.

Are you sure?  I can see %root_nodes% under the section "Default, Type and Position Format Bodycopies", under %asset_odd_even% and above %asset_contents_raw%.  Even tried changing the version widget in case it's just my version, but still seeing it.  Unless I'm seeing something different to you on this page??

%root_nodes% is not available at the type format level

Sorry, Tim. I misread. You are right - it's there. Aleks, are you sure? What you say seems to contradict the page linked to above.

^as_asset modifier would break on %root_nodes% as soon as there is more than 1 anyway, it's actually an array, not a single value, so that's probably why it wouldn't work for 1.

 

What you probably want is to do the ^as_asset modifier on your dynamic value that you are passing to the asset listing as the root node. For example, If you are passing it as a GET var via the current page URL like www.page.com?rootnode=1234, you could use %globals_get_rootnode^as_asset:asset_name% 

Thanks Bart!  That worked perfectly - I knew it would as soon as I read it (in fact had one of those 'well duh!' moments).

 

I still think it's interesting that %root_nodes% with as_asset works in one spot but not another, but I guess using root nodes on potential arrays, behaviour would be undefined?  So rather than a bug, the fact it works at all in one location is a bonus/feature (got my testing hat one now).

 

Thanks again to everyone who responded.