acf_render_bidirectional_field_settings()ACF 6.2

Renders the field settings required for bidirectional fields

No Hooks.

Returns

null. Nothing (null).

Usage

acf_render_bidirectional_field_settings( $field );
$field(array) (required)
The field object passed into field setting functions.

Changelog

Since 6.2 Introduced.

acf_render_bidirectional_field_settings() code ACF 6.8.8

function acf_render_bidirectional_field_settings( $field ) {
	if ( ! acf_get_setting( 'enable_bidirection' ) ) {
		return;
	}

	acf_render_field_setting(
		$field,
		array(
			'label'        => __( 'Bidirectional', 'acf' ),
			'instructions' => __( 'Update a field on the selected values, referencing back to this ID', 'acf' ),
			'type'         => 'true_false',
			'name'         => 'bidirectional',
			'ui'           => 1,
		)
	);

	acf_render_field_setting(
		$field,
		array(
			'name'       => 'bidirectional_notes',
			'type'       => 'message',
			'message'    => acf_get_bidirectional_field_settings_instruction_text(),
			'conditions' => array(
				'field'    => 'bidirectional',
				'operator' => '==',
				'value'    => 1,
			),
		)
	);

	acf_render_field_setting(
		$field,
		array(
			'type'         => 'select',
			'name'         => 'bidirectional_target',
			'label'        => __( 'Target Field', 'acf' ),
			'instructions' => __( 'Select field(s) to store the reference back to the item being updated. You may select this field. Target fields must be compatible with where this field is being displayed. For example, if this field is displayed on a Taxonomy, your target field should be of type Taxonomy', 'acf' ),
			'class'        => 'bidrectional_target',
			'choices'      => acf_build_bidirectional_target_current_choices( $field['bidirectional_target'] ),
			'conditions'   => array(
				'field'    => 'bidirectional',
				'operator' => '==',
				'value'    => 1,
			),
			'ui'           => 1,
			'multiple'     => 1,
			'ajax'         => 1,
		)
	);
}