Virtual Fields / Columns

I want to allow users to create their own custom fields without creating new db columns.
So i was planning to create two collections:

  • custom_text_field - where the user registers the fields that will be available.
  • custom_text_field_data - where the data would be stored.
    Then, i want these fields to be available on another collection “items”.
    The result would be:
  • The user create a custom field called “name” in custom_text_field.
  • This field is available inside the “items” collection.
  • When saved, data is added to custom_text_field_data as a new entry.
  • The “items” collection shows a “custom_field_name” column with the data.
  • Data can be imported and exported using “custom_field_name” within the “items” collection.
    Although complex, would this be possible using an extension with hooks?

Hello Renan,

Yes, it is possible you will have to create a new tabular layout and manage the logic, refer to this directus/app/src/layouts/tabular/index.ts at main · directus/directus · GitHub

Additional resource boiler plate for the core layout, but note it is a layout, not an interface:

Another solution is to mimic the CMS Template Forms & Form Fields set up:

Hope this helps find a solution.