WP_REST_View_Config_Controller::get_view_base_schema
Returns the schema properties shared by all view types (ViewBase), excluding 'type'.
Note that search and page are not part of the schema: they are managed via the URL, which is their only source of truth.
Method of the class: WP_REST_View_Config_Controller{}
No Hooks.
Returns
array. Schema properties for the base view configuration.
Usage
// protected - for code of main (parent) or child class $result = $this->get_view_base_schema();
Changelog
| Since 7.1.0 | Introduced. |
WP_REST_View_Config_Controller::get_view_base_schema() WP REST View Config Controller::get view base schema code WP 7.1
protected function get_view_base_schema() {
return array(
'filters' => array(
'type' => 'array',
'items' => array(
'type' => 'object',
'properties' => array(
'field' => array(
'type' => 'string',
),
'operator' => array(
'type' => 'string',
'enum' => array(
'is',
'isNot',
'isAny',
'isNone',
'isAll',
'isNotAll',
'lessThan',
'greaterThan',
'lessThanOrEqual',
'greaterThanOrEqual',
'before',
'after',
),
),
'value' => array(),
'isLocked' => array(
'type' => 'boolean',
),
),
),
),
'sort' => array(
'type' => 'object',
'properties' => array(
'field' => array(
'type' => 'string',
),
'direction' => array(
'type' => 'string',
'enum' => array( 'asc', 'desc' ),
),
),
),
'perPage' => array(
'type' => 'integer',
),
'fields' => array(
'type' => 'array',
'items' => array(
'type' => 'string',
),
),
'titleField' => array(
'type' => 'string',
),
'mediaField' => array(
'type' => 'string',
),
'descriptionField' => array(
'type' => 'string',
),
'showTitle' => array(
'type' => 'boolean',
),
'showMedia' => array(
'type' => 'boolean',
),
'showDescription' => array(
'type' => 'boolean',
),
'showLevels' => array(
'type' => 'boolean',
),
'groupBy' => array(
'type' => 'object',
'properties' => array(
'field' => array(
'type' => 'string',
),
'direction' => array(
'type' => 'string',
'enum' => array( 'asc', 'desc' ),
),
'showLabel' => array(
'type' => 'boolean',
'default' => true,
),
),
),
'infiniteScrollEnabled' => array(
'type' => 'boolean',
),
);
}