acf_field_select::get_rest_schema
Return the schema array for the REST API.
Метод класса: acf_field_select{}
Хуков нет.
Возвращает
array.
Использование
$acf_field_select = new acf_field_select(); $acf_field_select->get_rest_schema( $field );
- $field(массив) (обязательный)
- The main field array.
Код acf_field_select::get_rest_schema() acf field select::get rest schema ACF 6.8.8
public function get_rest_schema( array $field ) {
$schema = array(
'type' => array( 'string', 'array', 'int', 'null' ),
'required' => ! empty( $field['required'] ),
'items' => array(
'type' => array( 'string', 'int' ),
'enum' => $this->format_rest_choices( $field['choices'] ),
),
);
if ( empty( $field['allow_null'] ) ) {
$schema['minItems'] = 1;
}
if ( empty( $field['multiple'] ) ) {
$schema['maxItems'] = 1;
}
if ( isset( $field['default_value'] ) && '' !== $field['default_value'] ) {
$schema['default'] = $field['default_value'];
}
return $schema;
}