Skip to content

Repeatable fields not work in v2.2.6.1 #1058

@anhskohbo

Description

@anhskohbo

Expected Behavior:

The clone items not update the index in "name" attribute, see the screenshot:

screenshot from 2017-11-26 14-55-17

CMB2 Field Registration Code:

add_action( 'cmb2_admin_init', 'yourprefix_register_theme_options_metabox' );
/**
 * Hook in and register a metabox to handle a theme options page and adds a menu item.
 */
function yourprefix_register_theme_options_metabox() {

	/**
	 * Registers options page menu item and form.
	 */
	$cmb_options = new_cmb2_box( array(
		'id'           => 'yourprefix_theme_options_page',
		'title'        => esc_html__( 'Theme Options', 'cmb2' ),
		'object_types' => array( 'options-page' ),

		'option_key'      => 'yourprefix_theme_options',
		'icon_url'        => 'dashicons-palmtree',
	) );

	$cmb_options->add_field( array(
		'name'    => esc_html__( 'Site Background Color', 'cmb2' ),
		'desc'    => esc_html__( 'field description (optional)', 'cmb2' ),
		'id'      => 'bg_color',
		'type'    => 'text',
		'default' => '#ffffff',
		'repeatable' => true,
	) );
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions