Cmb2: render_row_cb does not work on group field type

Created on 20 Oct 2017  路  5Comments  路  Source: CMB2/CMB2

I'm using this extension to create tabs from metaboxes:
https://github.com/stackadroit/cmb2-extensions

All working correct except when I try to add a group field, it doesn't respond, I tracked this down and found that when I use
'render_row_cb' => array( 'CMB2_Tabs', 'tabs_render_row_cb' ), on group field, it doesn't return anything to the function that is responsible for arranging the field into tabs which cause the group to be out of the wrapper and not within tabs.

so simple question, is there a way to return $field_args and $field from group field to the function, and I'll sort the rest.

Most helpful comment

It was not possible, but just pushed an update to enable this feature. I'd encourage you to proceed with caution when using the callback. Unless you keep it close to the original callback, you're likely to break something with the repeatable/sortable functionality.

All 5 comments

You will need to open an issue on that repo.

@jtsternberg I did, I'm only asking here if there is a way to render group fields manually which is related to this repo.

Yes, if you take this line and add it this group field here, it will work as expected.

sorry I meant I want it work with the group type itself, not group fields

    $group_repeat = $cmb_repeat->add_field( array(
        'id'          => $prefix . 'group',
        'type'        => 'group',
        'options'     => array(
            'group_title'   => __( 'Product', 'cmb' ) . ' {#}', // {#} gets replaced by row number
            'add_button'    => __( 'Add Product', 'cmb' ),
            'remove_button' => __( 'Remove Product', 'cmb' ),
            // 'sortable'      => true, // beta
        ),
        'tab'  => 'products',
        'render_row_cb' => array( 'CMB2_Tabs', 'tabs_render_row_cb' ),
    ) );

It was not possible, but just pushed an update to enable this feature. I'd encourage you to proceed with caution when using the callback. Unless you keep it close to the original callback, you're likely to break something with the repeatable/sortable functionality.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

needtakehave picture needtakehave  路  7Comments

gorirrajoe picture gorirrajoe  路  4Comments

alanef picture alanef  路  4Comments

djob195 picture djob195  路  4Comments

mathetos picture mathetos  路  8Comments