WP_REST_Block_Pattern_Categories_Controller::get_item_schema(): array

In this article

Retrieves the block pattern category schema, conforming to JSON Schema.

Return

array Item schema data.

Source

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'      => 'block-pattern-category',
		'type'       => 'object',
		'properties' => array(
			'name'        => array(
				'description' => __( 'The category name.' ),
				'type'        => 'string',
				'readonly'    => true,
				'context'     => array( 'view', 'edit', 'embed' ),
			),
			'label'       => array(
				'description' => __( 'The category label, in human readable format.' ),
				'type'        => 'string',
				'readonly'    => true,
				'context'     => array( 'view', 'edit', 'embed' ),
			),
			'description' => array(
				'description' => __( 'The category description, in human readable format.' ),
				'type'        => 'string',
				'readonly'    => true,
				'context'     => array( 'view', 'edit', 'embed' ),
			),
		),
	);

	$this->schema = $schema;

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

Changelog

VersionDescription
6.0.0Introduced.

User Contributed Notes

You must log in before being able to contribute a note or feedback.