Skip to content

options page fields within repeatable groups display array() if empty fields are saved #332

Closed

Description

custom options page fields within repeatable groups display array() if empty fields are saved.
the custom options page is calling the function below:

function theme_options_metabox($metabox_id, $key) {

    $prefix = 'theme';
    $cmb_options = new_cmb2_box( array(
        'id'      => $metabox_id,
        'title'   => 'Theme Options',
        'hookup'  => false,
        'show_on' => array(
            'key'   => 'options-page',
            'value' => array( $key )
        )
    ) );

    $group_field_id = $cmb_options->add_field( array(
        'id'          => $prefix . 'demo',
        'type'        => 'group',
        'description' => __( 'Generates reusable form entries', 'cmb2' ),
        'options'     => array(
            'group_title'   => __( 'Entry {#}', 'cmb2' ),
            'add_button'    => __( 'Add Another Entry', 'cmb2' ),
            'remove_button' => __( 'Remove Entry', 'cmb2' ),
            'sortable'      => true,
        ),
    ) );

    $cmb_options->add_group_field( $group_field_id, array(
        'name'       => __( 'Entry Title', 'cmb2' ),
        'id'         => 'title',
        'type'       => 'text',
    ) );
}

wordpress version: 4.2.2
CMB2 version: 2.0.6

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions