Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
eriktelepovsky opened this issue Apr 4, 2017 · 0 comments
Labels

Comments

@eriktelepovsky
Copy link

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

@jtsternberg jtsternberg added the bug label Apr 4, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants