wpmetabox / meta-box

The best plugin for WordPress custom fields and custom meta boxes
https://metabox.io
1.19k stars 423 forks source link

Reusing field groups #1592

Open seaj1one opened 3 months ago

seaj1one commented 3 months ago

On the frontend there's a big drive to DRY (Don't repeat yourself). There a desire for page builders to add components as a feature. I'd love to see Meta box do the same thing.

Currently, as I'm creating custom field groups, I'm repeating myself. So If I creating a custom field group to mange the content for say a Hero, features and services section, I create custom fields for the title and introduction text for each section. I may want to manage the content for a card using Meta Box that has the same content structure .i.e. title, text and image. Again I have to create custom fields for each section.

I see that you have a function called "array_merge()" Source which solves that problem. While I've never implemented this, I suspect it will take me more time writing code over a GUI.

I'm suggesting a reusable template custom field area where you create custom field groups that are not assigned. It's used as a blueprint to use on any post type or page and across websites.

So what I'm thinking is to add an option called existing custom field group when you select add field or a similar name. I'm thinking that it should always be nested within another field group to avoid conflict with another custom field group. You can then select which custom field group to reuse from a list and be searchable.

For the developers, would you like to see this feature as an extension or part of the core Meta Box?

Is there anything that I've missed?