WP_REST_Menu_Items_Controller::get_item_schema() – Retrieves the term’s schema, conforming to JSON Schema.

You appear to be a bot. Output may be restricted

Description

Retrieves the term's schema, conforming to JSON Schema.

Usage

$array = WP_REST_Menu_Items_Controller::get_item_schema();

Parameters

Returns

array Item schema data.

Source

File name: wordpress/wp-includes/rest-api/endpoints/class-wp-rest-menu-items-controller.php


Lines:

1 to 100 of 216
  public function get_item_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' ),
      'context'     => array( 'view', 'edit', 'embed' ),
      'properties'  => array(
        'raw'      => array(
          'description' => __( 'Title for the object, as it exists in the database.' ),
          'type'        => 'string',
          'context'     => array( 'edit' ),
        ),
        'rendered' => array(
          'description' => __( 'HTML title for the object, transformed for display.' ),
          'type'        => 'string',
          'context'     => array( 'view', 'edit', 'embed' ),
          'readonly'    => true,
        ),
      ),
    );

    $schema['properties']['id'] = array(
      'description' => __( 'Unique identifier for the object.' ),
      'type'        => 'integer',
      'default'     => 0,
      'minimum'     => 0,
      'context'     => array( 'view', 'edit', 'embed' ),
      'readonly'    => true,
    );

    $schema['properties']['type_label'] = array(
      'description' => __( 'Name of type.' ),
      'type'        => 'string',
      'context'     => array( 'view', 'edit', 'embed' ),
      'readonly'    => true,
    );

    $schema['properties']['type'] = array(
      'description' => __( 'The family of objects originally represented, such as "post_type" or "taxonomy".' ),
      'type'        => 'string',
      'enum'        => array( 'taxonomy', 'post_type', 'post_type_archive', 'custom' ),
      'context'     => array( 'view', 'edit', 'embed' ),
      'default'     => 'custom',
    );

    $schema['properties']['status'] = array(
      'description' => __( 'A named status for the object.' ),
      'type'        => 'string',
      'enum'        => array_keys( get_post_stati( array( 'internal' => false ) ) ),
      'default'     => 'publish',
      'context'     => array( 'view', 'edit', 'embed' ),
    );

    $schema['properties']['parent'] = array(
      'description' => __( 'The ID for the parent of the object.' ),
      'type'        => 'integer',
      'minimum'     => 0,
      'default'     => 0,
      'context'     => array( 'view', 'edit', 'embed' ),
    );

    $schema['properties']['attr_title'] = array(
      'description' => __( 'Text for the title attribute of the link element for this menu item.' ),
      'type'        => 'string',
      'context'     => array( 'view', 'edit', 'embed' ),
      'arg_options' => array(
        'sanitize_callback' => 'sanitize_text_field',
      ),
    );

    $schema['properties']['classes'] = array(
      'description' => __( 'Class names for the link element of this menu item.' ),
      'type'        => 'array',
      'items'       => array(
        'type' => 'string',
      ),
      'context'     => array( 'view', 'edit', 'embed' ),
      'arg_options' => array(
        'sanitize_callback' => function ( $value ) {
          return array_map( 'sanitize_html_class', wp_parse_list( $value ) );
        },
      ),
    );

    $schema['properties']['description'] = array(
      'description' => __( 'The description of this menu item.' ),
      'type'        => 'string',
      'context'     => array( 'view', 'edit', 'embed' ),
      'arg_options' => array(
        'sanitize_callback' => 'sanitize_text_field',
      ),
    );

    $schema['properties']['menu_order'] = array(
      'description' => __( 'The DB ID of the nav_menu_item that is this item\'s menu parent, if any, otherwise 0.' ),

 View on GitHub View on Trac