acf_field_taxonomy::render_field_checkboxpublicACF 3.6

Create the HTML interface for your field

Method of the class: acf_field_taxonomy{}

Returns

null. Nothing (null).

Usage

$acf_field_taxonomy = new acf_field_taxonomy();
$acf_field_taxonomy->render_field_checkbox( $field );
$field(array) (required)
an array holding all the field's data.

Changelog

Since 3.6 Introduced.

acf_field_taxonomy::render_field_checkbox() code ACF 6.0.4

<?php
public function render_field_checkbox( $field ) {

	// hidden input.
	acf_hidden_input(
		array(
			'type' => 'hidden',
			'name' => $field['name'],
		)
	);

	// checkbox saves an array.
	if ( $field['field_type'] == 'checkbox' ) {

		$field['name'] .= '[]';

	}

	// taxonomy.
	$taxonomy_obj = get_taxonomy( $field['taxonomy'] );

	// include walker.
	acf_include( 'includes/walkers/class-acf-walker-taxonomy-field.php' );

	// vars.
	$args = array(
		'taxonomy'         => $field['taxonomy'],
		'show_option_none' => sprintf( _x( 'No %s', 'No Terms', 'acf' ), $taxonomy_obj->labels->name ),
		'hide_empty'       => false,
		'style'            => 'none',
		'walker'           => new ACF_Taxonomy_Field_Walker( $field ),
	);

	// filter for 3rd party customization.
	$args = apply_filters( 'acf/fields/taxonomy/wp_list_categories', $args, $field );
	$args = apply_filters( 'acf/fields/taxonomy/wp_list_categories/name=' . $field['_name'], $args, $field );
	$args = apply_filters( 'acf/fields/taxonomy/wp_list_categories/key=' . $field['key'], $args, $field );

	?>
<div class="categorychecklist-holder">
	<ul class="acf-checkbox-list acf-bl">
	<?php wp_list_categories( $args ); ?>
	</ul>
</div>
	<?php

}