ACF_Field_User::initializepublicACF 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.4.2

function initialize() {
	$this->name          = 'user';
	$this->label         = __( 'User', 'acf' );
	$this->category      = 'relational';
	$this->description   = __( 'Allows the selection of one or more users which can be used to create relationships between data objects.', 'acf' );
	$this->preview_image = acf_get_url() . '/assets/images/field-type-previews/field-preview-user.png';
	$this->doc_url       = acf_add_url_utm_tags( 'https://www.advancedcustomfields.com/resources/user/', 'docs', 'field-type-selection' );
	$this->defaults      = array(
		'role'                 => '',
		'multiple'             => 0,
		'allow_null'           => 0,
		'return_format'        => 'array',
		'bidirectional_target' => 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_filter( 'acf/conditional_logic/choices', array( $this, 'render_field_user_conditional_choices' ), 10, 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' ) );
}