ACF_Field_User::initialize()publicACF 5.0.0

Initializes the field type.

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

Хуков нет.

Возвращает

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

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

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

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

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

Код ACF_Field_User::initialize() ACF 6.0.4

function initialize() {

	// Props.
	$this->name     = 'user';
	$this->label    = __( 'User', 'acf' );
	$this->category = 'relational';
	$this->defaults = array(
		'role'          => '',
		'multiple'      => 0,
		'allow_null'    => 0,
		'return_format' => 'array',
	);

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

	// Add AJAX query.
	add_action( 'wp_ajax_acf/fields/user/query', array( $this, 'ajax_query' ) );
	add_action( 'wp_ajax_nopriv_acf/fields/user/query', array( $this, 'ajax_query' ) );
}