Skip to content

Commit

Permalink
Add get_item_schema function to WP_REST_Widget_Areas_Controller
Browse files Browse the repository at this point in the history
  • Loading branch information
jorgefilipecosta committed Jun 4, 2019
1 parent 0d60f1b commit 3145ffb
Showing 1 changed file with 47 additions and 0 deletions.
47 changes: 47 additions & 0 deletions lib/class-wp-rest-widget-areas-controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,53 @@ public function register_routes() {
);
}

/**
* Retrieves the comment's schema, conforming to JSON Schema.
*
* @since 4.7.0
*
* @return array
*/
public function get_item_schema() {
$schema = array(
'$schema' => 'http://json-schema.org/draft-04/schema#',
'title' => 'widget-area',
'type' => 'object',
'properties' => array(
'content' => array(
'description' => __( 'The content for the object.', 'gutenberg' ),
'type' => 'object',
'context' => array( 'view', 'edit', 'embed' ),
'arg_options' => array(
'sanitize_callback' => null,
'validate_callback' => null,
),
'properties' => array(
'raw' => array(
'description' => __( 'Content for the object, as it exists in the database.', 'gutenberg' ),
'type' => 'string',
'context' => array( 'view', 'edit', 'embed' ),
),
'rendered' => array(
'description' => __( 'HTML content for the object, transformed for display.', 'gutenberg' ),
'type' => 'string',
'context' => array( 'view', 'edit', 'embed' ),
'readonly' => true,
),
'block_version' => array(
'description' => __( 'Version of the content block format used by the object.', 'gutenberg' ),
'type' => 'integer',
'context' => array( 'view', 'edit', 'embed' ),
'readonly' => true,
),
),
),
),
);

return $schema;
}

/**
* Checks whether a given request has permission to read widget areas.
*
Expand Down

0 comments on commit 3145ffb

Please sign in to comment.