acf_field_post_object::render_field_settingspublicACF 3.6

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

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

Хуков нет.

Возвращает

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

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

$acf_field_post_object = new acf_field_post_object();
$acf_field_post_object->render_field_settings( $field );
$field(массив) (обязательный)
An array holding all the field's data.

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

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

Код acf_field_post_object::render_field_settings() ACF 6.4.2

public function render_field_settings( $field ) {
	acf_render_field_setting(
		$field,
		array(
			'label'        => __( 'Filter by Post Type', 'acf' ),
			'instructions' => '',
			'type'         => 'select',
			'name'         => 'post_type',
			'choices'      => acf_get_pretty_post_types(),
			'multiple'     => 1,
			'ui'           => 1,
			'allow_null'   => 1,
			'placeholder'  => __( 'All post types', 'acf' ),
		)
	);

	acf_render_field_setting(
		$field,
		array(
			'label'        => __( 'Filter by Post Status', 'acf' ),
			'instructions' => '',
			'type'         => 'select',
			'name'         => 'post_status',
			'choices'      => acf_get_pretty_post_statuses(),
			'multiple'     => 1,
			'ui'           => 1,
			'allow_null'   => 1,
			'placeholder'  => __( 'Any post status', 'acf' ),
		)
	);

	acf_render_field_setting(
		$field,
		array(
			'label'        => __( 'Filter by Taxonomy', 'acf' ),
			'instructions' => '',
			'type'         => 'select',
			'name'         => 'taxonomy',
			'choices'      => acf_get_taxonomy_terms(),
			'multiple'     => 1,
			'ui'           => 1,
			'allow_null'   => 1,
			'placeholder'  => __( 'All taxonomies', 'acf' ),
		)
	);

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

	acf_render_field_setting(
		$field,
		array(
			'label'        => __( 'Select Multiple', 'acf' ),
			'instructions' => 'Allow content editors to select multiple values',
			'name'         => 'multiple',
			'type'         => 'true_false',
			'ui'           => 1,
		)
	);
}