acf_field_post_object::get_rest_schemapublicACF 5.11

Return the schema array for the REST API.

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

Хуков нет.

Возвращает

Массив.

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

$acf_field_post_object = new acf_field_post_object();
$acf_field_post_object->get_rest_schema( $field );
$field(массив) (обязательный)
The field array.

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

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

Код acf_field_post_object::get_rest_schema() ACF 6.4.2

public function get_rest_schema( array $field ) {
	$schema = array(
		'type'     => array( 'integer', 'array', 'null' ),
		'required' => ! empty( $field['required'] ),
		'items'    => array(
			'type' => 'integer',
		),
	);

	if ( empty( $field['allow_null'] ) ) {
		$schema['minItems'] = 1;
	}

	if ( empty( $field['multiple'] ) ) {
		$schema['maxItems'] = 1;
	}

	return $schema;
}