acf_field_taxonomy::render_field_checkbox
Create the HTML interface for your field
Метод класса: acf_field_taxonomy{}
Хуки из метода
Возвращает
null. Ничего (null).
Использование
$acf_field_taxonomy = new acf_field_taxonomy(); $acf_field_taxonomy->render_field_checkbox( $field );
- $field(массив) (обязательный)
- an array holding all the field's data.
Список изменений
| С версии 3.6 | Введена. |
Код acf_field_taxonomy::render_field_checkbox() acf field taxonomy::render field checkbox ACF 6.4.2
<?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
}