WP_REST_Revisions_Controller::get_item_schema PHP Method

get_item_schema() public method

Retrieves the revision's schema, conforming to JSON Schema.
Since: 4.7.0
public get_item_schema ( ) : array
return array Item schema data.
    public function get_item_schema()
    {
        $schema = array('$schema' => 'http://json-schema.org/schema#', 'title' => "{$this->parent_post_type}-revision", 'type' => 'object', 'properties' => array('author' => array('description' => __('The ID for the author of the object.'), 'type' => 'integer', 'context' => array('view', 'edit', 'embed')), 'date' => array('description' => __('The date the object was published.'), 'type' => 'string', 'format' => 'date-time', 'context' => array('view', 'edit', 'embed')), 'date_gmt' => array('description' => __('The date the object was published, as GMT.'), 'type' => 'string', 'format' => 'date-time', 'context' => array('view', 'edit')), 'guid' => array('description' => __('GUID for the object, as it exists in the database.'), 'type' => 'string', 'context' => array('view', 'edit')), 'id' => array('description' => __('Unique identifier for the object.'), 'type' => 'integer', 'context' => array('view', 'edit', 'embed')), 'modified' => array('description' => __('The date the object was last modified.'), 'type' => 'string', 'format' => 'date-time', 'context' => array('view', 'edit')), 'modified_gmt' => array('description' => __('The date the object was last modified, as GMT.'), 'type' => 'string', 'format' => 'date-time', 'context' => array('view', 'edit')), 'parent' => array('description' => __('The ID for the parent of the object.'), 'type' => 'integer', 'context' => array('view', 'edit', 'embed')), 'slug' => array('description' => __('An alphanumeric identifier for the object unique to its type.'), 'type' => 'string', 'context' => array('view', 'edit', 'embed'))));
        $parent_schema = $this->parent_controller->get_item_schema();
        if (!empty($parent_schema['properties']['title'])) {
            $schema['properties']['title'] = $parent_schema['properties']['title'];
        }
        if (!empty($parent_schema['properties']['content'])) {
            $schema['properties']['content'] = $parent_schema['properties']['content'];
        }
        if (!empty($parent_schema['properties']['excerpt'])) {
            $schema['properties']['excerpt'] = $parent_schema['properties']['excerpt'];
        }
        if (!empty($parent_schema['properties']['guid'])) {
            $schema['properties']['guid'] = $parent_schema['properties']['guid'];
        }
        return $this->add_additional_fields_schema($schema);
    }