Cms: FR: Allow multiple instances of a configured field in a single field layout

Created on 6 Feb 2018  路  2Comments  路  Source: craftcms/cms

This would likely be a big change, but thought I'd throw it out there, perhaps to be considered with https://github.com/craftcms/cms/issues/1524


Field configuration can be complex, especially with a heavily configured Matrix field.
It would be ideal if one could create a field and use multiple instances of it in a single field layout.

Use-case:

A fairly common practice for module page building seems to be including a mega "Content Matrix" field, with many block types for all types of content. This has a breaking point when you need two independent sets of these blocks (e.g. _Content Matrix Main_, _Content Matrix Sidebar_).

Duplicating a second field is tough, and keeping them in-sync over time is even harder.

This could potentially also be a solution for issues like https://github.com/craftcms/cms/issues/806, as each field instance could have it's own title and instructions.

I toyed around with the idea of creating a plugin with a "Proxy FieldType", where the only field setting was a field selection of the field you wanted to mirror. Works great for things stored in content, but obviously gets complicated with Matrix and others, which is really what you'd want it for. Let me know if you think this might be do-able and/or more appropriate via plugin, or if it is something you'd consider for core/v4/fantasy land.

enhancement system administration

Most helpful comment

What I've done for this in the past is creating a Field Group that encompasses everything that should be added to a new section. There are a couple of issues with this, however.

  1. If you change the Field Group, it doesn't change the fields actually added to the section(s); it's really just organizational.
  2. You can't then use these Field Groups in a Matrix block

I think this is one of the reasons why Neo is popular, it lets you use field layouts with block content... and re-use them.

Part of the flexibility of Craft is that you can re-use fields, and you can add/remove fields from any Section layout or matrix block.

Still, it'd be pretty interesting to have a "Field Container" or such which would be a collection of arbitrary fields, but in the Field Layout editor, it's treated as one chunk that's always moved together.

If you want to change what fields are in it, you change those in the Field Container settings... and any changes made there would globally affect any instances of that Field Container.

Really, we're just looking for a way to group fields together in more than just an organizational manner (which is still useful in its own right).

All 2 comments

What I've done for this in the past is creating a Field Group that encompasses everything that should be added to a new section. There are a couple of issues with this, however.

  1. If you change the Field Group, it doesn't change the fields actually added to the section(s); it's really just organizational.
  2. You can't then use these Field Groups in a Matrix block

I think this is one of the reasons why Neo is popular, it lets you use field layouts with block content... and re-use them.

Part of the flexibility of Craft is that you can re-use fields, and you can add/remove fields from any Section layout or matrix block.

Still, it'd be pretty interesting to have a "Field Container" or such which would be a collection of arbitrary fields, but in the Field Layout editor, it's treated as one chunk that's always moved together.

If you want to change what fields are in it, you change those in the Field Container settings... and any changes made there would globally affect any instances of that Field Container.

Really, we're just looking for a way to group fields together in more than just an organizational manner (which is still useful in its own right).

Agree it would be nice.

Was this page helpful?
0 / 5 - 0 ratings