Skip to content

[J4.x] [RFC] New custom field type - multiform? #36710

Open

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:

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

  1. Multi form element
    1. Element field(s) (subform, select existing custom fields)
    2. Element name
    3. Element custom field layout ?
    4. Element thumbnail/icon?
    5. Max # of elements?
  2. Multiform element
    1. Element field(s) (subform, select existing custom fields... including subforms?)
    2. Element name
    3. Element custom field layout ?
    4. Element thumbnail//icon?
    5. Max # of elements?
  3. Add new multiform element

Screen Shot 2022-01-16 at 19 02 30

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.

Screen Shot 2022-01-16 at 19 12 56

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions