acf_field_taxonomy::initialize()publicACF 5.0.0

__construct

This function will setup the field type data

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

Хуков нет.

Возвращает

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

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

$acf_field_taxonomy = new acf_field_taxonomy();
$acf_field_taxonomy->initialize();

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

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

Код acf_field_taxonomy::initialize() ACF 6.0.4

function initialize() {

	// vars
	$this->name     = 'taxonomy';
	$this->label    = __( 'Taxonomy', 'acf' );
	$this->category = 'relational';
	$this->defaults = array(
		'taxonomy'      => 'category',
		'field_type'    => 'checkbox',
		'multiple'      => 0,
		'allow_null'    => 0,
		'return_format' => 'id',
		'add_term'      => 1, // 5.2.3
		'load_terms'    => 0, // 5.2.7
		'save_terms'    => 0, // 5.2.7
	);

	// Register filter variations.
	acf_add_filter_variations( 'acf/fields/taxonomy/query', array( 'name', 'key' ), 1 );
	acf_add_filter_variations( 'acf/fields/taxonomy/result', array( 'name', 'key' ), 2 );

	// ajax
	add_action( 'wp_ajax_acf/fields/taxonomy/query', array( $this, 'ajax_query' ) );
	add_action( 'wp_ajax_nopriv_acf/fields/taxonomy/query', array( $this, 'ajax_query' ) );
	add_action( 'wp_ajax_acf/fields/taxonomy/add_term', array( $this, 'ajax_add_term' ) );

	// actions
	add_action( 'acf/save_post', array( $this, 'save_post' ), 15, 1 );

}