Project overview
Directus Polymorphic Reference models flexible relations where a record points to different entity types through a target collection and target ID. The pattern is similar to polymorphic relations known from frameworks such as Laravel and makes it usable in Directus through an interface and display bundle.
The extension stores the target collection and target ID in separate fields, while presenting them as one understandable reference in the interface. Editors first choose the entity type and then select the matching record.
For list and detail views, output can be shaped through templates. Polymorphic references appear as readable, navigable links instead of raw IDs.
What the extension covers
Collection Select interface for the type field of a polymorphic reference
Polymorphic Reference interface for selecting the target record
Display component with links into the matching Directus collection
Template-based labels per target collection for readable list views
Setup and usage
- 1Configure one field for the target type as Collection Select.
- 2Configure one field for the target ID as Polymorphic Reference.
- 3Optionally define templates and link behavior per collection.