This is basically the same as https://www.drupal.org/project/ideas/issues/607396 (and related to the older https://www.drupal.org/project/ideas/issues/501366)
Problem/Motivation In most Drupal projects, the need comes up for a collection of fields. This is normally achieved with a light-weight entity such as Paragraphs or Field collection.
In Drupal 8 the go to solution for this is the Paragraphs module, which over time was also expanded to control content-type display, so that content editors could effectively control layouts with it.
Now Drupal core has a stable layout builder, the need to use it for layouts is no more, but there is still a need to use it for compound fields. This however doesn't integrate as well with layout builder, because there is a disconnect between content-editing and layout building.
In addition, in core we have a use case for such a compound field in the ingredients field on the Umami recipe content type. At present it is implemented as a text-field, which prevents us from using Drupal's modelling tools to build powerful features such as a view listing 'all recipes featuring chocolate'. This is because the ingredients field is used to list three distinct items. E.g.
1 cup of flour
When really this should be three fields
1 (quantity) cup (unit) of flour (ingredient)
If we had a way to build compound fields from the UI in core, we could construct a new field-type for the ingredients list comprising the following sub-fields
- Quantity - number
- Unit - text-list or taxonomy term
- Ingredient - taxonomy term
This would unlock Drupal's relationship modelling power.
Proposed resolution Add a compound field type to core with a proposed target of being an experimental module in Drupal 9.1
The field will provide a UI to allow site-builders to build new field-types by combining existing field types.
All other functionality should continue to work.
- Views support
- formatter support
- widget support
- data storage and retrieval
- serializer support (JSON API etc)
- translation support
- revision support
Remaining tasks Work has commenced in both the Field union (PreviousNext) and rich field (Lullabot) projects to investigate how feasible this is.
The two have agreed to join-forces and work towards a common goal
We have a slack channel #multifield
Recent comments
Hi patch-works I did something similar with Drupal 7: a block with aniversaries of historical dates. You can see it at https://lassalle-kreis.de/ down in the blue footer, the middle column...
How to get a list of upcoming birthdays?
@indigoxela - I agree, I mentioned the SVG topic specifically for the dev meeting. I think we'll definitely want Nate involved in that discussion. Good call!
Apr 18th Weekly Meetings
Hi colbyat, re display in the browser: the problem is that when a 500 occurs, this PHP process died before being able to render anything. So that won't work. Logging is possible, but...
Displaying 500 errors