WP_REST_Icons_Controller::get_item_schema │ public │ WP 7.0.0

Retrieves the icon schema, conforming to JSON Schema.

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

Хуков нет.

Возвращает

array. Item schema data.

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

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

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

С версии 7.0.0 Введена.
С версии 7.1.0 Added the collection property.

Код WP_REST_Icons_Controller::get_item_schema() WP 7.1.4

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'      => 'icon',
		'type'       => 'object',
		'properties' => array(
			'name'       => array(
				'description' => __( 'The icon name.' ),
				'type'        => 'string',
				'readonly'    => true,
				'context'     => array( 'view', 'edit', 'embed' ),
			),
			'label'      => array(
				'description' => __( 'The icon label.' ),
				'type'        => 'string',
				'readonly'    => true,
				'context'     => array( 'view', 'edit', 'embed' ),
			),
			'content'    => array(
				'description' => __( 'The icon content (SVG markup).' ),
				'type'        => 'string',
				'readonly'    => true,
				'context'     => array( 'view', 'edit', 'embed' ),
			),
			'collection' => array(
				'description' => __( 'The slug of the collection this icon belongs to.' ),
				'type'        => 'string',
				'readonly'    => true,
				'context'     => array( 'view', 'edit', 'embed' ),
			),
		),
	);

	$this->schema = $schema;

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