Description
Problem identified
So, I LOVE custom fields and use them constantly in the sites I build. One annoyance/hinderance is their total reliance on article categories for assignment; it's fine if you have, say, a news or projects category and all the fields are the same for each page. But it's inflexible if there are pages that have one-off layouts, like a home page, or other unique pages like a features or about page.
The current solution is to create a category for each page so that you can assign the appropriate custom fields in the appropriate order. But, this ends up with a complicated category structure, SO many duplicate/similar custom fields, and messed up SEF urls unless you're SUPER careful about routing, and it seems excessive for one page design at a time.
Often, sites have common design components/sections...but, depending on the content of the page, they appear in a different order, or there's a different number of them.
For example, the following pages from a recent project of mine all use the common elements of "section with background image", "section with no image", "section with image to the side", etc, but the order and number depend on the page content:
- https://felidaefund.org/learn/protecting-healthy-ecosystems
- https://felidaefund.org/learn/safety-essentials-wild-cats
- https://felidaefund.org/learn/living-alongside-wild-cats
I was able to make it work with a subform in this case, but because some fields like "image" apply to some layouts and not others, editing it is cumbersome and error-prone. It also wouldn't work if the design components/sections didn't have so much in common.
Proposed solution
What if we had a custom field kind of like a subform, but with different row types available? It's not quite like a page builder because it's not WYSIWYG, it's just the appropriate fields. While the use case above is why I thought of this "multiform" idea, I'd imagine it could be used for other things too.
I tried to develop one based on the subform custom field and couldn't get it to work, but this is something like what I'm imagining:
Custom Field configuration
When adding it in the back end, you have a nested subform
- Multi form element
- Element field(s) (subform, select existing custom fields)
- Element name
- Element custom field layout ?
- Element thumbnail/icon?
- Max # of elements?
- Multiform element
- Element field(s) (subform, select existing custom fields... including subforms?)
- Element name
- Element custom field layout ?
- Element thumbnail//icon?
- Max # of elements?
- Add new multiform element
Editing field in article
The different "elements" or row types would be above the rows, and you could drag them into the structure or click them to add to the end. The elements would count down how many "allowed" left and disable when appropriate.
You could also drag the sections to change the order.
Open questions
- Since each row is more self-contained than in current subforms, would the showon attribute work within each element? 🤔
This is way beyond my technical ability, but it would make building complex sites with Joomla 4 so much easier/faster, and managing them would be cleaner. It would be a super powerful and compelling feature, and since it would be a self-contained custom field plugin, I think it could be added to any new point release (if I understand correctly)?
Would love to hear thoughts, constructive criticism, and discussion on this!