Skip to content

"Notice: Array to string conversion" of multicheck field in own field type #62

Open

Description

@eriktelepovsky

I followed this example: https://github.com/WebDevStudios/CMB2/wiki/Adding-your-own-field-types#example-4-multiple-inputs-one-field-lets-create-an-address-field

Everything works fine until I change type of 'state' field from select to multicheck.

Expected Behavior:

Change select dropdown to multicheck checkboxes.

Actual Behavior:

It throws Notice: Array to string conversion in .../wp-content/plugins/cmb2/includes/types/CMB2_Type_Base.php on line 103

Steps to reproduce (I have confirmed I can reproduce this issue on the trunk branch):

Create custom field type address using this snippet:

https://github.com/WebDevStudios/CMB2-Snippet-Library/blob/master/custom-field-types/address-field-type.php

and change select to multicheck on line 134.

CMB2 Field Registration Code:

add_action( 'cmb2_admin_init', 'yourprefix_register_demo_metabox' );
function yourprefix_register_demo_metabox() {

	$cmb = new_cmb2_box( array(
		// Box Config...
	) );

	$cmb->add_field( array(
		// Field Config...
                'type' => 'address'
	) );
}

Thank you for any help.

Reference: CMB2/CMB2#801

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions