LLMS_REST_Controller::get_item_schema()
Get the LLMS REST resource schema, conforming to JSON Schema.
Return Return
(array)
Source Source
File: libraries/lifterlms-rest/includes/abstracts/class-llms-rest-controller.php
public function get_item_schema() {
if ( isset( $this->schema ) ) {
// Additional fields are not cached in the schema, @see https://core.trac.wordpress.org/ticket/47871#comment:5.
return $this->add_additional_fields_schema( $this->schema );
}
$schema = $this->get_item_schema_base();
// Add custom fields registered via `register_meta()`.
$schema = $this->add_meta_fields_schema( $schema );
// Allow the schema to be filtered.
$schema = $this->filter_item_schema( $schema );
/**
* Set `$this->schema` here so that we can exclude additional fields
* already covered by the base, filtered, schema.
*
* Additional fields are added through the call to add_additional_fields_schema() below,
* which will call {@see LLMS_REST_Controller::get_additional_fields()}, which requires
* `$this->schema` to be set.
*/
$this->schema = $schema;
/**
* Adds the schema from additional fields (registered via `register_rest_field()`) to the schema array.
* Note: WordPress core doesn't cache the additional fields in the schema, see https://core.trac.wordpress.org/ticket/47871#comment:5
*/
return $this->add_additional_fields_schema( $this->schema );
}
Expand full source code Collapse full source code View on GitHub
Changelog Changelog
| Version | Description |
|---|---|
| 1.0.0-beta.27 | Introduced. |