acf_field_post_object::get_rest_schema
Return the schema array for the REST API.
Method of the class: acf_field_post_object{}
No Hooks.
Returns
array.
Usage
$acf_field_post_object = new acf_field_post_object(); $acf_field_post_object->get_rest_schema( $field );
- $field(array) (required)
- The field array.
Changelog
| Since 5.11 | Introduced. |
acf_field_post_object::get_rest_schema() acf field post object::get rest schema code ACF 6.8.8
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;
}