Cascading metadata to new assets


(Anthony) #1

I just realised that “cascading” a metadata value is a one time thing and doesn’t make new assets inherit the cascaded value. Which gives me a challenge and I’m hoping someone can suggest the best approach…

 

I have 30+ folders on my site that represent “branches” of my organisation. Within each is a hierarchy of stuff relevant to that branch, including news and event assets.  I’m building pages that will aggregate latest news and events from across the country. Simple asset list that pulls from the overall root folder. In the entry for each item, I need to show which branch its associated with, and other details from that asset.

 

So I created a metadata schema with an entry for “Branch” and set that on each branch root folder (pointing to itself, with the cascade set). Thus in the asset listing I have lots of %asset_metadata_Branch^as_asset:….% Works fine… until someone adds a new asset and the metadata field is blank because cascade isn’t dynamic. Because of the way these areas are maintained its not acceptable to expect the authors to remember to go set the field manually each time. Here are some of the ideas I had, would love to know what people think is best, and any better ideas:

 

  • Create a separate trigger for every branch, and have it set the metadata value for any new item. How big an overhead is having 30+ separate triggers on every Asset Create event?
  • Create a separate metadata asset for each branch with identically named fields, but with the default value (which does cascade automatically) set for the branch it will be applied to. Not sure how the system works if multiple metadata schema all have a field called “Branch”?
  • Write some sort of background script that could run regularly under “cron” and effectively do the cascade. I’m sure its easy for someone who knows how the Squiz low level stuff works but I would be starting from scratch so it’s a big challenge. Could possibly pay Squiz to do it.

 

I just wish there was some sort of %parent…% keyword. I realise there’s a conceptual problem that an asset can be linked to multiple places in the tree and have multiple parent, but in my case I know that wont happen so its frustrating not to have something. Maybe a %parent_assets% that returns a comma sep list of all parent asset ID’s and those of us who can guarantee it will only ever have one entry can go ahead and safely use it with ^as_asset etc !

 

All helpful suggestions gratefully received!


(Nic Hubbard) #2

 

  • Create a separate trigger for every branch, and have it set the metadata value for any new item. How big an overhead is having 30+ separate triggers on every Asset Create event?

 

 This could slow down the system, and would be a huge pain to have to manage that amount of triggers just for this one functionality.

 

 

  • Create a separate metadata asset for each branch with identically named fields, but with the default value (which does cascade automatically) set for the branch it will be applied to. Not sure how the system works if multiple metadata schema all have a field called “Branch”?
 

 

This could work quite well. As long as you don't apply two Metadata Schemas to the same asset, with the same field names, there won't be any conflicts.

 

 

I just wish there was some sort of %parent…% keyword. I realise there’s a conceptual problem that an asset can be linked to multiple places in the tree and have multiple parent, but in my case I know that wont happen so its frustrating not to have something. Maybe a %parent_assets% that returns a comma sep list of all parent asset ID’s and those of us who can guarantee it will only ever have one entry can go ahead and safely use it with ^as_asset etc !

 

 

What about creating an Asset Listing that looks up the tree at direct parents, and then set the Dynamic Root node to the current asset. It could print out a comma separated list and could do so with the %globals_asset_contents_raw:1123% keyword. Would that be helpful?


(Anthony) #3

The advice is much appreciated, thanks Nic. I've now had a chance to test with multiple sets of metadata all with the same field name, and that does seem to work well. I noted I can even set "editbale = no" when I define the metadata field so effectively the default value is the only possible value, and nobody can inadvertantly screw it up!

 

I've thought about an "upwards" asset listing once before, and I see what you're thinking... it could work... if I could still put ^as_asset on the end of asset_contents_raw (knowing in my case there would only be one number in the "list"). The metadata solution is more work to create up front but seems a lot simpler so for now so I'll go with that! I still maintain a "%parent_..." would be a lovely thing to have one day!