acf_field_relationship::initializepublicACF 5.0.0

This function will setup the field type data

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

Хуков нет.

Возвращает

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

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

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

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

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

Код acf_field_relationship::initialize() ACF 6.4.2

public function initialize() {
	$this->name          = 'relationship';
	$this->label         = __( 'Relationship', 'acf' );
	$this->category      = 'relational';
	$this->description   = __( 'A dual-column interface to select one or more posts, pages, or custom post type items to create a relationship with the item that you\'re currently editing. Includes options to search and filter.', 'acf' );
	$this->preview_image = acf_get_url() . '/assets/images/field-type-previews/field-preview-relationship.png';
	$this->doc_url       = acf_add_url_utm_tags( 'https://www.advancedcustomfields.com/resources/relationship/', 'docs', 'field-type-selection' );
	$this->defaults      = array(
		'post_type'            => array(),
		'taxonomy'             => array(),
		'min'                  => 0,
		'max'                  => 0,
		'filters'              => array( 'search', 'post_type', 'taxonomy' ),
		'elements'             => array(),
		'return_format'        => 'object',
		'bidirectional_target' => array(),
	);
	add_filter( 'acf/conditional_logic/choices', array( $this, 'render_field_relation_conditional_choices' ), 10, 3 );

	// extra
	add_action( 'wp_ajax_acf/fields/relationship/query', array( $this, 'ajax_query' ) );
	add_action( 'wp_ajax_nopriv_acf/fields/relationship/query', array( $this, 'ajax_query' ) );
}