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

select_all_button => false not working for taxonomy multicheck #1005

Closed
arkytn opened this issue Aug 2, 2017 · 6 comments
Closed

select_all_button => false not working for taxonomy multicheck #1005

arkytn opened this issue Aug 2, 2017 · 6 comments
Labels

Comments

@arkytn
Copy link

arkytn commented Aug 2, 2017

select_all_button => false not working for taxonomy multicheck. Reason is it needs a space added in front of the 'no-select-all. Otherwise the class concatenation runs together
Line 70 of \cmb2\includes\types\CMB2_Type_Taxonomy_Multicheck.php should be:

$classes .= ' no-select-all';

(space in front of no-select-all

@tw2113
Copy link
Contributor

tw2113 commented Aug 2, 2017

Can you provide the config code you're using for this, so we can confirm it's a legitimate bug or possibly something from the config only or the site in question. Thanks.

@arkytn
Copy link
Author

arkytn commented Aug 2, 2017

Real simple

$cmb->add_field( array(
	'name'     => $taxonomy->label,
	'id'       => "submitted_{$taxonomy->name}",
	'type'     => $taxonomy->hierarchical ? 'taxonomy_multicheck' : 'taxonomy_select' ,
	'select_all_button' => false,
	'taxonomy' => $taxonomy->name, // Taxonomy Slug
) );

Doesn't turn off the select all button.

If you look at the code at line 67 of cmb2\includes\types\CMB2_Type_Taxonomy_Multicheck.php:

protected function get_wrapper_classes() {
	$classes = 'cmb2-checkbox-list cmb2-list';
	if ( false === $this->field->args( 'select_all_button' ) ) {
		$classes .= 'no-select-all';
	}
	return $classes;
}

You are concating 'cmb2-checkbox-list cmb2-list' with 'no-select-all' resulting in

'cmb2-checkbox-list cmb2-listno-select-all'

which kills the meaning of both 'cmb2-list' and 'no-select-all'
You need to add the space so you get

'cmb2-checkbox-list cmb2-list no-select-all'

which works properly.
Nothing to do with setting or sites.

@tw2113
Copy link
Contributor

tw2113 commented Aug 2, 2017

Can confirm this in trunk, it's not in the release version of the plugin yet.

@tw2113 tw2113 added the bug label Aug 2, 2017
@arkytn
Copy link
Author

arkytn commented Aug 2, 2017

Thank you

@arkytn arkytn closed this as completed Aug 2, 2017
@arkytn arkytn reopened this Aug 2, 2017
@allysonsouza
Copy link

I'm having the same problem, CMB2 version 2.2.5.3

@jtsternberg
Copy link
Member

Thank you for reporting @allysonsouza. Fixed in trunk and will be in the next release.

jtsternberg added a commit that referenced this issue Nov 14, 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

4 participants