@davidfor: looking again at the code, I now think I was being way too pessimistic about using templates. If you add the checkbox you suggested then:
- If the box isn't checked then "collection_attributes" is set to the contents of the box as is done today.
- If the box is checked then collection_attributes is set to something like "template", which cannot otherwise appear because there is no standard lookup name 'template'.
- When getting the values for a "collection attribute" (a lookup name), if the name is "template" then get the list of values from the template, otherwise from the column.
- The rest of the processing is unchanged.
This idea leaves open the possibility of intermixing values from columns (lookup names) and results of a template. If instead of the checkbox you add a template box then the code could process any keys in the standard box then process the results of the template. Doing this would support using 'standard' values unchanged along with adding 'custom' values without using custom columns.
Apologies for being a bit dense.
EDIT: if you want me to send you proof-of-concept code for the above, let me know. It is a small change from what I have already done.