acf_field_radio::get_rest_schema
Return the schema array for the REST API.
Method of the class: acf_field_radio{}
No Hooks.
Returns
array.
Usage
$acf_field_radio = new acf_field_radio(); $acf_field_radio->get_rest_schema( $field );
- $field(array) (required)
- .
acf_field_radio::get_rest_schema() acf field radio::get rest schema code ACF 6.8.8
function get_rest_schema( array $field ) {
$schema = parent::get_rest_schema( $field );
if ( isset( $field['default_value'] ) && '' !== $field['default_value'] ) {
$schema['default'] = $field['default_value'];
}
// If other/custom choices are allowed, nothing else to do here.
if ( ! empty( $field['other_choice'] ) ) {
return $schema;
}
$schema['enum'] = acf_get_field_type( 'select' )->format_rest_choices( $field['choices'] );
if ( ! empty( $field['allow_null'] ) ) {
$schema['enum'][] = null;
}
return $schema;
}