WP_REST_Menu_Locations_Controller::get_item_schema()publicWP 5.9.0

Retrieves the menu location's schema, conforming to JSON Schema.

Метод класса: WP_REST_Menu_Locations_Controller{}

Хуков нет.

Возвращает

Массив. Item schema data.

Использование

$WP_REST_Menu_Locations_Controller = new WP_REST_Menu_Locations_Controller();
$WP_REST_Menu_Locations_Controller->get_item_schema();

Список изменений

С версии 5.9.0 Введена.

Код WP_REST_Menu_Locations_Controller::get_item_schema() WP 6.5.2

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'      => 'menu-location',
		'type'       => 'object',
		'properties' => array(
			'name'        => array(
				'description' => __( 'The name of the menu location.' ),
				'type'        => 'string',
				'context'     => array( 'embed', 'view', 'edit' ),
				'readonly'    => true,
			),
			'description' => array(
				'description' => __( 'The description of the menu location.' ),
				'type'        => 'string',
				'context'     => array( 'embed', 'view', 'edit' ),
				'readonly'    => true,
			),
			'menu'        => array(
				'description' => __( 'The ID of the assigned menu.' ),
				'type'        => 'integer',
				'context'     => array( 'embed', 'view', 'edit' ),
				'readonly'    => true,
			),
		),
	);

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