Select options from related asset


Matrix Version: 5.5

I am using the following keyword chain to display the select options from a metadata schema:


Which is printing fine.

However, I am now building this into a paint layout to enable users to select which schema to use. I am doing this by adding a related asset field (topic_related).

Testing. The following will print the correct asset ID for the selected schema on page.


However, when joining this to the above, I am not getting a result.

This is what I have chained together:


Suggestions as to how I can modify the above to get the desired result would be greatly appreciated.

Thank you.

(John gill) #2

I always favour as_asset


over replace_keywords


It’s clearer and safer (fewer potential execution order issues).


Thanks @JohnGill, this worked like a charm.
Merry Christmas :christmas_tree:


Carrying on from this discussion, is there a way to set a default select if no value exists.

Such as:
%asset_metadata_select_related^as_asset:asset_data_attributes^index:select_options^index:value^empty:index:select_options^index:newvalue% ?

I can write a short bit of JS to accommodate the action, but still trying to get myself around chaining keywords and modifiers.

Thanks again

(John gill) #5

There’s no shortcuts, the fallback would need to be a whole keyword the same as the outer one. It’d probably be: