Returns the schema for a form field item (string or object).
Source
protected function get_form_field_schema() {
return array(
'oneOf' => array(
array( 'type' => 'string' ),
array(
'type' => 'object',
'properties' => array(
'id' => array(
'type' => 'string',
),
'label' => array(
'type' => 'string',
),
'description' => array(
'type' => 'string',
),
'layout' => $this->get_form_layout_schema(),
'children' => array(
'type' => 'array',
'items' => array(
'oneOf' => array(
array( 'type' => 'string' ),
// This object can have the shape of a form field itself,
// allowing for recursive nesting of form fields.
// There's no easy way to codify this recursion via the JSON Schema draft-04
// supported by the REST API.
array( 'type' => 'object' ),
),
),
),
),
),
),
);
}
Changelog
| Version | Description |
|---|---|
| 7.1.0 | Introduced. |
User Contributed Notes
You must log in before being able to contribute a note or feedback.