acf_field_taxonomy::render_field_settings()publicACF 3.6

Create extra options for your field. This is rendered when editing a field. The value of $field['name'] can be used (like bellow) to save extra data to the $field

@type action

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

Хуков нет.

Возвращает

null. Ничего.

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

$acf_field_taxonomy = new acf_field_taxonomy();
$acf_field_taxonomy->render_field_settings( $field );
$field (обязательный)
-

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

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

Код acf_field_taxonomy::render_field_settings() ACF 5.10.2

function render_field_settings( $field ) {

	// default_value
	acf_render_field_setting(
		$field,
		array(
			'label'        => __( 'Taxonomy', 'acf' ),
			'instructions' => __( 'Select the taxonomy to be displayed', 'acf' ),
			'type'         => 'select',
			'name'         => 'taxonomy',
			'choices'      => acf_get_taxonomy_labels(),
		)
	);

	// field_type
	acf_render_field_setting(
		$field,
		array(
			'label'        => __( 'Appearance', 'acf' ),
			'instructions' => __( 'Select the appearance of this field', 'acf' ),
			'type'         => 'select',
			'name'         => 'field_type',
			'optgroup'     => true,
			'choices'      => array(
				__( 'Multiple Values', 'acf' ) => array(
					'checkbox'     => __( 'Checkbox', 'acf' ),
					'multi_select' => __( 'Multi Select', 'acf' ),
				),
				__( 'Single Value', 'acf' )    => array(
					'radio'  => __( 'Radio Buttons', 'acf' ),
					'select' => _x( 'Select', 'noun', 'acf' ),
				),
			),
		)
	);

	// allow_null
	acf_render_field_setting(
		$field,
		array(
			'label'        => __( 'Allow Null?', 'acf' ),
			'instructions' => '',
			'name'         => 'allow_null',
			'type'         => 'true_false',
			'ui'           => 1,
			'conditions'   => array(
				'field'    => 'field_type',
				'operator' => '!=',
				'value'    => 'checkbox',
			),
		)
	);

	// add_term
	acf_render_field_setting(
		$field,
		array(
			'label'        => __( 'Create Terms', 'acf' ),
			'instructions' => __( 'Allow new terms to be created whilst editing', 'acf' ),
			'name'         => 'add_term',
			'type'         => 'true_false',
			'ui'           => 1,
		)
	);

	// save_terms
	acf_render_field_setting(
		$field,
		array(
			'label'        => __( 'Save Terms', 'acf' ),
			'instructions' => __( 'Connect selected terms to the post', 'acf' ),
			'name'         => 'save_terms',
			'type'         => 'true_false',
			'ui'           => 1,
		)
	);

	// load_terms
	acf_render_field_setting(
		$field,
		array(
			'label'        => __( 'Load Terms', 'acf' ),
			'instructions' => __( 'Load value from posts terms', 'acf' ),
			'name'         => 'load_terms',
			'type'         => 'true_false',
			'ui'           => 1,
		)
	);

	// return_format
	acf_render_field_setting(
		$field,
		array(
			'label'        => __( 'Return Value', 'acf' ),
			'instructions' => '',
			'type'         => 'radio',
			'name'         => 'return_format',
			'choices'      => array(
				'object' => __( 'Term Object', 'acf' ),
				'id'     => __( 'Term ID', 'acf' ),
			),
			'layout'       => 'horizontal',
		)
	);

}