Render multiple_references field by reference of the reference


I want to understand how a UI Extension would return a list of checkboxes each representing a reference, grouped by a reference field of that reference.

Imagine I am tagging blog posts. All tags are a ‘tag’ content type, and each tag has a title and a reference to ‘tag type’. Tag types categorise my tags in a way that helps the author know what to tag their blog post with. Tag types might include: subject, reading length and tone.

In the UI I would like to render a checkbox for each of the tags, but in way that that each tag is grouped with other tags of the same tag type. E.g. tags ‘happy’, ‘sad’, ‘moany’ would be grouped under a heading of ‘Tone’, and ‘maths’, ‘english’ and ‘science’ under a heading of ‘subject’.

Does this approach sound feasible?

Hi @ajackson

So, in short, what you would like to do is having a reference field that displays all available references and, with that, you’d select which of those you’d like to link to that given entry?

Yes. Except all the available references would be sorted by a field of the reference. This field would be a reference to the type of tag it was.

The psuedo code would be something like:

For each tag_type:
print tag_type header
for each tag:
if tag has tag_type:
print tag