acf_field_taxonomy::render_field_select()publicACF 3.6

Create the HTML interface for your field

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

Хуков нет.

Возвращает

null. Ничего (null).

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

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

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

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

Код acf_field_taxonomy::render_field_select() ACF 6.0.4

function render_field_select( $field ) {

	// Change Field into a select
	$field['type']    = 'select';
	$field['ui']      = 1;
	$field['ajax']    = 1;
	$field['choices'] = array();

	// value
	if ( ! empty( $field['value'] ) ) {

		// get terms
		$terms = $this->get_terms( $field['value'], $field['taxonomy'] );

		// set choices
		if ( ! empty( $terms ) ) {

			foreach ( array_keys( $terms ) as $i ) {

				// vars
				$term = acf_extract_var( $terms, $i );

				// append to choices
				$field['choices'][ $term->term_id ] = $this->get_term_title( $term, $field );

			}
		}
	}

	// render select
	acf_render_field( $field );

}