Based on feedback from users, we've just released a new feature for our cloneable fields. Previously, there were always visible inputs for you to enter data for cloneable fields. And when you want more instances, you need to click the “+ Add New” button.
From now on, you can decide to hide all inputs at first, and when you need to enter data, you’ll need to click the “+ Add New” button. This means that there may be no items, instead of at least one as before. This update is also a step forward in the UX/UI of Meta Box.
Why This Feature?
The user interface plays an important role in plugin development. That’s why we pay a lot of attention and effort to improve that. Last month, we updated the interface for MB Custom Post Types and Custom Taxonomies, and before that for rendering the block and Meta Box Builder.
Cloning field is also an essential feature for storing data and building a website. It allows you to create multiple inputs without declaring a bunch of fields.
Combining those two factors with user feedback, we release a new feature that allows hiding all the clones. In other words, there may be no clones on the screen. This setting is now available in Meta Box. It can help make the interface of data inputting cleaner and easier to understand.
This feature is applied to any cloneable field, including groups. Let’s see it in detail.
Configuration
Previously, when a field or group is set as cloneable, all the fields or subfields of the group will be displayed in the post editor. And you couldn’t remove them all, so there was at least one clone/entry all the time:
From the Meta Box version 5.10, you will have an option to hide them all.
If you’re using the Meta Box Builder extension, you can find this new setting when configuring the field.
If you’re using code, please add the option 'clone_empty_start' => true
to your field settings, like this:
$meta_box[] = [ 'title' => 'Product Information', 'fields' => [ [ 'title' => 'Features', 'type' => 'group', 'clone' => true, 'clone_empty_start' => true, // THIS 'fields' => [ // List of sub-fields for the group. ], ], ], ];
After setting up the fields, go to edit a post. And you’ll see only the + Add more button will display at the first time you input data. No entry anymore. So, the group will be empty entirely instead of always having subfields inside as before. The subfields will be displayed as usual when you click on the button.
After having some clones/entries, you can remove all of them as well.
It means that the visible minimum of the clone/entry is zero now. This new feature helps keep your post editor clean and organized until you’re ready to add any items, especially if your field structure is complicated.
To avoid backward compatibility issues, we set the status of this setting as FALSE by default. All the field groups you have created before are not affected at all.
Last Words
With these improvements in the user interface, we hope that you love it and enjoy interacting with Meta Box.
Your voice guides our improvements. Let us know your feedback or requests in the comment. Thanks for reading!
I’ve been looking forward to this enhancement for years! Thanks a lot.