WP_REST_Icons_Controller::get_item_schema(): array

In this article

Retrieves the icon 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'      => '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' ),
			),
		),
	);

	$this->schema = $schema;

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

User Contributed Notes

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