add_additional_fields_schema example

return rest_filter_response_by_context( $response_data$schema$context );
    }

    /** * Retrieves the item's schema, conforming to JSON Schema. * * @since 4.7.0 * * @return array Item schema data. */
    public function get_item_schema() {
        return $this->add_additional_fields_schema( array() );
    }

    /** * Retrieves the item's schema for display / public consumption purposes. * * @since 4.7.0 * * @return array Public item schema data. */
    public function get_public_item_schema() {

        


    /** * Retrieves the user's schema, conforming to JSON Schema. * * @since 4.7.0 * * @return array Item schema data. */
    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'      => 'user',
            'type'       => 'object',
            'properties' => array(
                'id'                 => array(
                    'description' => __( 'Unique identifier for the user.' ),
                    'type'        => 'integer',
                    'context'     => array( 'embed', 'view', 'edit' ),
                    


    /** * Retrieves the theme's schema, conforming to JSON Schema. * * @since 5.5.0 * * @return array Item schema data. */
    public function get_item_schema() {
        if ( $this->schema ) {
            return $this->add_additional_fields_schema( $this->schema );
        }

        $this->schema = array(
            '$schema'    => 'http://json-schema.org/draft-04/schema#',
            'title'      => 'block-directory-item',
            'type'       => 'object',
            'properties' => array(
                'name'                => array(
                    'description' => __( 'The block name, in namespace/block-name format.' ),
                    'type'        => 'string',
                    'context'     => array( 'view' ),
                ),


    /** * Retrieves the post's schema, conforming to JSON Schema. * * @since 4.7.0 * * @return array Item schema data. */
    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'      => $this->post_type,
            'type'       => 'object',
            // Base properties for every Post.             'properties' => array(
                'date'         => array(
                    'description' => __( "The date the post was published, in the site's timezone." ),
                    'type'        => array( 'string', 'null' ),
                    


    /** * Retrieves the fallbacks' schema, conforming to JSON Schema. * * @since 6.3.0 * * @return array Item schema data. */
    public function get_item_schema() {
        if ( $this->schema ) {
            return $this->add_additional_fields_schema( $this->schema );
        }

        $this->schema = array(
            '$schema'    => 'http://json-schema.org/draft-04/schema#',
            'title'      => 'navigation-fallback',
            'type'       => 'object',
            'properties' => array(
                'id' => array(
                    'description' => __( 'The unique identifier for the Navigation Menu.' ),
                    'type'        => 'integer',
                    'context'     => array( 'view', 'edit', 'embed' ),
                    


    /** * Retrieves the attachment's schema, conforming to JSON Schema. * * @since 4.7.0 * * @return array Item schema as an array. */
    public function get_item_schema() {
        if ( $this->schema ) {
            return $this->add_additional_fields_schema( $this->schema );
        }

        $schema = parent::get_item_schema();

        $schema['properties']['alt_text'] = array(
            'description' => __( 'Alternative text to display when attachment is not displayed.' ),
            'type'        => 'string',
            'context'     => array( 'view', 'edit', 'embed' ),
            'arg_options' => array(
                'sanitize_callback' => 'sanitize_text_field',
            ),
        );


    /** * Retrieves the block type' schema, conforming to JSON Schema. * * @since 5.8.0 * * @return array Item schema data. */
    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'      => 'sidebar',
            'type'       => 'object',
            'properties' => array(
                'id'            => array(
                    'description' => __( 'ID of sidebar.' ),
                    'type'        => 'string',
                    'context'     => array( 'embed', 'view', 'edit' ),
                    


    /** * Retrieves the theme's schema, conforming to JSON Schema. * * @since 5.0.0 * * @return array Item schema data. */
    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'      => 'theme',
            'type'       => 'object',
            'properties' => array(
                'stylesheet'     => array(
                    'description' => __( 'The theme\'s stylesheet. This uniquely identifies the theme.' ),
                    'type'        => 'string',
                    'readonly'    => true,
                ),


    /** * Retrieves the application password's schema, conforming to JSON Schema. * * @since 5.6.0 * * @return array Item schema data. */
    public function get_item_schema() {
        if ( $this->schema ) {
            return $this->add_additional_fields_schema( $this->schema );
        }

        $this->schema = array(
            '$schema'    => 'http://json-schema.org/draft-04/schema#',
            'title'      => 'application-password',
            'type'       => 'object',
            'properties' => array(
                'uuid'      => array(
                    'description' => __( 'The unique identifier for the application password.' ),
                    'type'        => 'string',
                    'format'      => 'uuid',
                    


    /** * Retrieves the term's schema, conforming to JSON Schema. * * @since 5.9.0 * * @return array Item schema data. */
    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'   => $this->post_type,
            'type'    => 'object',
        );

        $schema['properties']['title'] = array(
            'description' => __( 'The title for the object.' ),
            'type'        => array( 'string', 'object' ),
            
/** * Retrieves the block type' schema, conforming to JSON Schema. * * @since 5.8.0 * @since 5.9.0 Added `'area'`. * * @return array Item schema data. */
    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'      => $this->post_type,
            'type'       => 'object',
            'properties' => array(
                'id'             => array(
                    'description' => __( 'ID of template.' ),
                    'type'        => 'string',
                    'context'     => array( 'embed', 'view', 'edit' ),
                    


    /** * Retrieves the widget type's schema, conforming to JSON Schema. * * @since 5.8.0 * * @return array Item schema data. */
    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' ),
                    


    /** * Retrieves the term's schema, conforming to JSON Schema. * * @since 4.7.0 * * @return array Item schema data. */
    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'      => 'post_tag' === $this->taxonomy ? 'tag' : $this->taxonomy,
            'type'       => 'object',
            'properties' => array(
                'id'          => array(
                    'description' => __( 'Unique identifier for the term.' ),
                    'type'        => 'integer',
                    'context'     => array( 'view', 'embed', 'edit' ),
                    
/** * Retrieves the block type' schema, conforming to JSON Schema. * * @since 5.5.0 * @since 6.3.0 Added `selectors` field. * * @return array Item schema data. */
    public function get_item_schema() {
        if ( $this->schema ) {
            return $this->add_additional_fields_schema( $this->schema );
        }

        // rest_validate_value_from_schema doesn't understand $refs, pull out reused definitions for readability.         $inner_blocks_definition = array(
            'description' => __( 'The list of inner blocks used in the example.' ),
            'type'        => 'array',
            'items'       => array(
                'type'       => 'object',
                'properties' => array(
                    'name'        => array(
                        'description' => __( 'The name of the inner block.' ),
                        
/** * Retrieves the taxonomy's schema, conforming to JSON Schema. * * @since 4.7.0 * @since 5.0.0 The `visibility` property was added. * @since 5.9.0 The `rest_namespace` property was added. * * @return array Item schema data. */
    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'      => 'taxonomy',
            'type'       => 'object',
            'properties' => array(
                'capabilities'   => array(
                    'description' => __( 'All capabilities used by the taxonomy.' ),
                    'type'        => 'object',
                    'context'     => array( 'edit' ),
                    
Home | Imprint | This part of the site doesn't use cookies.