directus/directus

Matrix/Replicator Field Type

bcartier asked for this feature 11 months ago — 3 comments

bcartier commented 11 months ago

A field type similar to Statamic's Replicator (https://docs.statamic.com/fieldtypes/replicator) or the Craft CMS Matrix Field (https://craftcms.com/docs/matrix-fields) that would allow you to build an entry from various blocks (other fields). Add a WYSIWYG block, then a relationship field pulling from other tables, then another WYSIWYG, then and image block etc... This allows you to keep the WYSIWYG field simpler (without having to embed everything inside it), while having editorial freedom well-structured content.

| benhaynes commented 6 months ago Admin

FeatHub butchers the whitespace formatting here

Same as current M2M UI, except: 1. Junction table also stores the related table 2. UI is editable inline instead of each item opening in an overlay

Below is one direction, but you could just as easily store data in the junction table itself instead of multiple related tables.

Example of schema:

THIS TABLE - matrix_column (ALIAS) Like a M2M but also stores the related table...

JUNCTION TABLE - id - sort - matrixid - relatedtable (NEW!) - related_id

RELATED TABLE VARCHAR - id - title (VARCHAR)

RELATED TABLE TEXT - id - text (TEXT)

RELATED TABLE INT - id - image (INT)

Example of what junction table stores:

{ id: 1, sort: 1, parentid: 1, relatedtable: 'varchar', relatedid: 1, data: { title: "My Matrix Title" } }, { id: 2, sort: 2, parentid: 1, relatedtable: 'text', relatedid: 1, data: { text: "Lorem ipsum dolor et..." } }, { id: 3, sort: 3, parentid: 1, relatedtable: 'image', related_id: 1, data: { image: 1, data: { url: "my-file.jpg" } } }

| luminarious commented 20 days ago

This and Postgres support were the two reasons we didn't go with Directus for a medium-sized content site (couple of hundred pages in 3 languages) at my current organization, despite the really good overall developer experience 😞

Join the discussion!

Sign-in with GitHub to comment