Hi,
it's great that group field types are finally working.
But there still seems to be a bug.
Let's say I have an image field inside a group field.
When adding a new group item and selecting the image for the new item only the image of the first item get's set/replaced.
This clearly is a bug within laygridder as this works correctly when using the group field as a normal meta box (e.g. on a page).
You can use this code to try it out:
add_action('cmb2_admin_init', function(){
$cmb = new_cmb2_box([
'id' => 'cmb_repeater_metabox',
'title' => 'Repeateable groups',
]);
$groups = $cmb->add_field([
'id' => 'cmb_groups',
'type' => 'group',
'options' => [
'group_title' => 'Entry {#}',
'add_button' => 'Add another entry',
'remove_button' => 'Remove entry',
'sortable' => true,
],
]);
$cmb->add_group_field(
$groups,
[
'id' => 'cmb_groups_image',
'name' => 'Image',
'type' => 'file',
]
);
$cmb->add_group_field(
$groups,
[
'id' => 'cmb_groups_text',
'name' => 'Text',
'type' => 'textarea_small'
]
);
});
add_filter('lg_cmb2_modals', function ($metaboxFormIds) {
$metaboxFormIds[] = 'cmb_repeater_metabox';
return $metaboxFormIds;
});