acf_field_page_link::get_rest_schemapublicACF 1.0

Return the schema array for the REST API.

Method of the class: acf_field_page_link{}

No Hooks.

Returns

Array.

Usage

$acf_field_page_link = new acf_field_page_link();
$acf_field_page_link->get_rest_schema( $field );
$field(array) (required)
.

acf_field_page_link::get_rest_schema() code ACF 6.0.4

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

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

	if ( ! empty( $field['allow_archives'] ) ) {
		$schema['type'][]          = 'string';
		$schema['items']['type'][] = 'string';
	}

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

	return $schema;
}