WP_REST_Widget_Types_Controller::get_item_schema()
Retrieves the widget type's schema, conforming to JSON Schema.
Method of the class: WP_REST_Widget_Types_Controller{}
No Hooks.
Return
Array
. Item schema data.
Usage
$WP_REST_Widget_Types_Controller = new WP_REST_Widget_Types_Controller(); $WP_REST_Widget_Types_Controller->get_item_schema();
Changelog
Since 5.8.0 | Introduced. |
WP_REST_Widget_Types_Controller::get_item_schema() WP REST Widget Types Controller::get item schema code WP 6.6.2
public function get_item_schema() { if ( $this->schema ) { return $this->add_additional_fields_schema( $this->schema ); } $schema = array( '$schema' => 'http://json-schema.org/draft-04/schema#', 'title' => 'widget-type', 'type' => 'object', 'properties' => array( 'id' => array( 'description' => __( 'Unique slug identifying the widget type.' ), 'type' => 'string', 'context' => array( 'embed', 'view', 'edit' ), 'readonly' => true, ), 'name' => array( 'description' => __( 'Human-readable name identifying the widget type.' ), 'type' => 'string', 'default' => '', 'context' => array( 'embed', 'view', 'edit' ), 'readonly' => true, ), 'description' => array( 'description' => __( 'Description of the widget.' ), 'type' => 'string', 'default' => '', 'context' => array( 'view', 'edit', 'embed' ), ), 'is_multi' => array( 'description' => __( 'Whether the widget supports multiple instances' ), 'type' => 'boolean', 'context' => array( 'view', 'edit', 'embed' ), 'readonly' => true, ), 'classname' => array( 'description' => __( 'Class name' ), 'type' => 'string', 'default' => '', 'context' => array( 'embed', 'view', 'edit' ), 'readonly' => true, ), ), ); $this->schema = $schema; return $this->add_additional_fields_schema( $this->schema ); }