Group of fields inside group of fields
-
Hi,
I’m trying to make next thing:
Ingredients group must contain Group name and a group of 3 fields: name, value, amount.
$ingredients_group_field_id = $cmb->add_field( array( 'id' => RECIPES_THEME_PREFIX . 'recipe_ingredients', 'type' => 'group', 'description' => __( 'Generates reusable form entries', 'cmb2' ), // 'repeatable' => false, // use false if you want non-repeatable group 'options' => array( 'group_title' => __( 'Ingredients group {#}', 'cmb2' ), // since version 1.1.4, {#} gets replaced by row number 'add_button' => __( 'Add Another Entry', 'cmb2' ), 'remove_button' => __( 'Remove Entry', 'cmb2' ), 'sortable' => true, // beta // 'closed' => true, // true to have the groups closed by default ), ) ); $cmb->add_group_field( $ingredients_group_field_id, array( 'name' => 'Fill Ingredients Group Name', 'id' => RECIPES_THEME_PREFIX . 'recipe_ingredients_group_name', 'type' => 'text', // 'repeatable' => true, // Repeatable fields are supported w/in repeatable groups (for most types) ) ); $ingredients_field_id = $cmb->add_group_field( $ingredients_group_field_id, array( 'id' => RECIPES_THEME_PREFIX . 'recipe_ingredients_data', 'type' => 'group', 'description' => __( 'Generates reusable form entries', 'cmb2' ), // 'repeatable' => false, // use false if you want non-repeatable group 'options' => array( 'group_title' => __( 'Ingredients set {#}', 'cmb2' ), // since version 1.1.4, {#} gets replaced by row number 'add_button' => __( 'Add Another Entry', 'cmb2' ), 'remove_button' => __( 'Remove Entry', 'cmb2' ), 'sortable' => true, // beta // 'closed' => true, // true to have the groups closed by default ), ) ); $cmb->add_group_field( $ingredients_field_id, array( 'name' => 'Choose Ingredients Group Name', 'id' => RECIPES_THEME_PREFIX . 'recipe_ingredients_name', 'type' => 'text', // 'repeatable' => true, // Repeatable fields are supported w/in repeatable groups (for most types) ) ); $cmb->add_group_field( $ingredients_field_id, array( 'name' => 'Choose Ingredients Group Name', 'id' => RECIPES_THEME_PREFIX . 'recipe_ingredients_amount', 'type' => 'text', // 'repeatable' => true, // Repeatable fields are supported w/in repeatable groups (for most types) ) ); $cmb->add_group_field( $ingredients_field_id, array( 'name' => 'Choose Ingredients Group Name', 'id' => RECIPES_THEME_PREFIX . 'recipe_ingredients_value', 'type' => 'text', // 'repeatable' => true, // Repeatable fields are supported w/in repeatable groups (for most types) ) );
But with no luck ??
I’ve got
array_key_exists(): The first argument should be either a string or an integer
wp-content/plugins/cmb2/includes/CMB2.php:887Could you help me to deal with?
Thank you in advance!
Viewing 10 replies - 1 through 10 (of 10 total)
Viewing 10 replies - 1 through 10 (of 10 total)
- The topic ‘Group of fields inside group of fields’ is closed to new replies.