datafield
Multiple Data Field is a Drupal module that allows you to create custom fields with multiple values under the default table form.
Base on module triple field
and paragraphs table
But it offers additional features.
Please note: all custom fields are not entity fields, so you cannot benefit from field widget, field renderer, or the entity formatter. It's just for the data.
How it works
To use the Multiple Data Field module, follow these steps:
- Step 1: Define the storage column machine name with an unlimited value.
- Step 2: Define field columns setings
- Step 3: Define in field widget for each columns
- Step 4: Define in field display for each columns
Supported storage types
Multiple Data Field supports various storage types, including:
- Numeric: Int, float, decimal
- Text: Varcha, Text, Json
- Boolean
- Date iso format: varchar (22)
- Date mysql format: Date, datetime, time, Year
- entity reference: Taxonomy, Node, User, ..., with Views reference
- File
Supported widgets
Multiple Data Field supports various widgets, including:
- Numeric: Textfield, range, number, select list, hidden
- Text: Textfield, Textarea, Text full html, Json editor, hidden
- Boolean: checkbox
- Date iso format: Date, datetime, month, week, year
- Date format: Date, datetime, timestamp, time, year
- Entity reference: List, auto commplete, radiobuton, hierachical select (taxonomy only)
- File: file manager
Supportes formatters
Multiple Data Field supports various formatters, including:
- Table (Boostrap-table, datatable) support field permission for create edit on fly
- Chart google chart, hightchart
- Unformat list order
- Details
Shortcuts
- Alt+N : New row
- Ctr+D : Duplicate row
- Ctr+↑ : Up row
- Ctr+↓ : down row
- Move with arrows ↑ → ↓ ←: up down left right
Some issue
- The time of the field date (iso and unix date), which has a widget time, needs to be checked with the time zone. It has not been tested in all cases.
- Field file may have problems when deleting old files, and an ajax call must be sent to remove the fid in field columns.
Plugin for developper
- You can create custom modules and define your field types, field widgets and field formatters. It can auto detect in your_module/src/Plugin/Data Field/[FieldType|FieldWidget|FieldFormatter]
In progress
Module is still under development, and the following features are currently in progress:
- Edit in the field (in display mode)
- Improve compatibility with the jsonapi , restful module. (Json with entity or file so ugly, It have to query with value entity.field_datafield.subfield.value[0].name)
Any help you can give will be greatly appreciated
The module data field version 2.x
In version 2.x field storage has changed, when entering the field storage settings section after setting up the subfield, you can change/add/remove the subfield name but you should be careful, not to do it too quickly before the ajax finish every time it changes.
Don't change the subfield name and cardinality to be unlimited at the same time. Beaucase ajax in Drupal 10.2 will reset the default field storage to the value of the subfield.
Section Field settings work normally, many error messages may come from the required field. check on checkbox the default value you can see.
Nothing much changed between version 3.x vs 2.x, mainly remove datafield.module switch to hook object which has been supported since drupal 11
Do you like this module? Show your appreciation by buying me ☕.