Open banderon opened 10 years ago
May want to take a look at http://www.advancedcustomfields.com/add-ons/repeater-field/ for ideas on UI. Skip to about 1:10 in the video for the post editor view.
Is there a need for these to also be orderable?
Orderability seems like it would be very useful in situations where order matters and a new row needs to be added in between existing rows.
I made an issue #13 for adding groupable fields. This would allow for duplicating multiple fields together.
We should be able to specify that a field can be duplicatable, with more rows created using an "Add More" button. Implementation should be via the
$args
array to maintain backwards compatibility.Off the top of my head, I can think of the following arguments that could be useful:
Saving the rows under the same meta key would not work since that wouldn't preserve order, which often matters. I'd suggest saving each row with a unique name based on the row (ex:
FIELD_row-#
), along with a total count of rows (FIELD_num-rows
) to provide a context for how many items are retrievable.Another concern is that the default callback for each field currently contains the label and description as well, which likely don't need to be duplicated along with the field. We could pull out the actual field elements themselves into separate functions and could those multiple times within their current callback functions. We'd also have to consider how this might affect custom callbacks and multiple callbacks.