acf_field_taxonomy::render_field()publicACF 3.6

Create the HTML interface for your field

@type action

{} Это метод класса: acf_field_taxonomy{}

Хуков нет.

Возвращает

null. Ничего.

Использование

$acf_field_taxonomy = new acf_field_taxonomy();
$acf_field_taxonomy->render_field( $field );
$field (обязательный)
-

Список изменений

С версии 3.6 Введена.

Код acf_field_taxonomy::render_field() ACF 5.10.2

<?php
function render_field( $field ) {

	// force value to array
	$field['value'] = acf_get_array( $field['value'] );

	// vars
	$div = array(
		'class'           => 'acf-taxonomy-field',
		'data-save'       => $field['save_terms'],
		'data-ftype'      => $field['field_type'],
		'data-taxonomy'   => $field['taxonomy'],
		'data-allow_null' => $field['allow_null'],
	);

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

	// bail early if taxonomy does not exist
	if ( ! $taxonomy ) {
		return;
	}

	?>
<div <?php acf_esc_attr_e( $div ); ?>>
	<?php if ( $field['add_term'] && current_user_can( $taxonomy->cap->manage_terms ) ) : ?>
	<div class="acf-actions -hover">
<a href="#" class="acf-icon -plus acf-js-tooltip small" data-name="add" title="<?php echo esc_attr( $taxonomy->labels->add_new_item ); ?>"></a>
	</div>
		<?php
	endif;

	if ( $field['field_type'] == 'select' ) {

		$field['multiple'] = 0;

		$this->render_field_select( $field );

	} elseif ( $field['field_type'] == 'multi_select' ) {

		$field['multiple'] = 1;

		$this->render_field_select( $field );

	} elseif ( $field['field_type'] == 'radio' ) {

		$this->render_field_checkbox( $field );

	} elseif ( $field['field_type'] == 'checkbox' ) {

		$this->render_field_checkbox( $field );

	}

	?>
</div>
	<?php

}