-
Notifications
You must be signed in to change notification settings - Fork 566
Closed
Description
Expected Behavior:
Adding a new row in a repeater uses the default setting for select fields, as defined by the field itself.
Actual Behavior:
2nd row select fields use the first item in the options array instead of the default.
Steps to reproduce (I have confirmed I can reproduce this issue on the trunk branch):
- Create a group field with a select as a group field.
- Set a default for the select that is NOT the first item in the options.
- Create more than 1 row and the 2nd and on rows will not use the default for the select.
CMB2 Field Registration Code:
add_action('cmb2_init', function() {
$cmb = new_cmb2_box([
'id' => 'test',
'title' => 'Test',
'object_types' => ['post'],
'context' => 'normal',
'priority' => 'default'
]);
$group_field_id = $cmb -> add_field([
'id' => 'group',
'type' => 'group'
]);
$cmb->add_group_field( $group_field_id, array(
'name' => __( 'Select Field', 'textdomain' ),
'id' => 'height',
'type' => 'select',
'default' => 'md',
'options' => array(
'auto' => __( 'Auto', 'textdomain' ),
'xs' => __( 'Extra Small', 'textdomain' ),
'sm' => __( 'Small', 'textdomain' ),
'md' => __( 'Medium (Should Be Default)', 'textdomain' ),
'lg' => __( 'Large', 'textdomain' ),
'xl' => __( 'Extra Large', 'textdomain' ),
),
) );
}, 20, 2 );
This was originally brought up in #853 (comment) but later realized this was a different issue. Sorry!
Metadata
Metadata
Assignees
Labels
No labels