WP_REST_Sidebars_Controller::get_item_schema() – Retrieves the block type’ schema, conforming to JSON Schema.

You appear to be a bot. Output may be restricted

Description

Retrieves the block type' schema, conforming to JSON Schema.

Usage

$array = WP_REST_Sidebars_Controller::get_item_schema();

Parameters

Returns

array Item schema data.

Source

File name: wordpress/wp-includes/rest-api/endpoints/class-wp-rest-sidebars-controller.php
Lines:

1 to 85 of 85
  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' ),
          'readonly'    => true,
        ),
        'name'          => array(
          'description' => __( 'Unique name identifying the sidebar.' ),
          'type'        => 'string',
          'context'     => array( 'embed', 'view', 'edit' ),
          'readonly'    => true,
        ),
        'description'   => array(
          'description' => __( 'Description of sidebar.' ),
          'type'        => 'string',
          'context'     => array( 'embed', 'view', 'edit' ),
          'readonly'    => true,
        ),
        'class'         => array(
          'description' => __( 'Extra CSS class to assign to the sidebar in the Widgets interface.' ),
          'type'        => 'string',
          'context'     => array( 'embed', 'view', 'edit' ),
          'readonly'    => true,
        ),
        'before_widget' => array(
          'description' => __( 'HTML content to prepend to each widget\'s HTML output when assigned to this sidebar. Default is an opening list item element.' ),
          'type'        => 'string',
          'default'     => '',
          'context'     => array( 'embed', 'view', 'edit' ),
          'readonly'    => true,
        ),
        'after_widget'  => array(
          'description' => __( 'HTML content to append to each widget\'s HTML output when assigned to this sidebar. Default is a closing list item element.' ),
          'type'        => 'string',
          'default'     => '',
          'context'     => array( 'embed', 'view', 'edit' ),
          'readonly'    => true,
        ),
        'before_title'  => array(
          'description' => __( 'HTML content to prepend to the sidebar title when displayed. Default is an opening h2 element.' ),
          'type'        => 'string',
          'default'     => '',
          'context'     => array( 'embed', 'view', 'edit' ),
          'readonly'    => true,
        ),
        'after_title'   => array(
          'description' => __( 'HTML content to append to the sidebar title when displayed. Default is a closing h2 element.' ),
          'type'        => 'string',
          'default'     => '',
          'context'     => array( 'embed', 'view', 'edit' ),
          'readonly'    => true,
        ),
        'status'        => array(
          'description' => __( 'Status of sidebar.' ),
          'type'        => 'string',
          'enum'        => array( 'active', 'inactive' ),
          'context'     => array( 'embed', 'view', 'edit' ),
          'readonly'    => true,
        ),
        'widgets'       => array(
          'description' => __( 'Nested widgets.' ),
          'type'        => 'array',
          'items'       => array(
            'type' => array( 'object', 'string' ),
          ),
          'default'     => array(),
          'context'     => array( 'embed', 'view', 'edit' ),
        ),
      ),
    );

    $this->schema = $schema;

    return $this->add_additional_fields_schema( $this->schema );
  }
 

 View on GitHub View on Trac