Automattic\WooCommerce\Api\Infrastructure

MetadataController::get_field_definitionpublic staticWC 1.0

Field definition for the root _apiMetadata query, in the shape the autogenerated RootQueryType expects (same as every autogenerated resolver's get_field_definition()).

Method of the class: MetadataController{}

No Hooks.

Returns

Array. mixed>

Usage

$result = MetadataController::get_field_definition(): array;

MetadataController::get_field_definition() code WC 10.9.1

public static function get_field_definition(): array {
	return array(
		'type'        => Type::nonNull( Type::listOf( Type::nonNull( self::get_target_type() ) ) ),
		'description' => __(
			'Lists metadata attached to elements of this schema. All filter arguments are optional; supplying multiple narrows the result. Use this to discover internal-use APIs, beta features, ownership, etc., or to ask "can I use this specific element?".',
			'woocommerce'
		),
		'args'        => array(
			'name'      => array(
				'type'        => Type::string(),
				'description' => __( 'Match rows that carry a metadata entry with this name. Surviving rows have their entries trimmed to the matching one.', 'woocommerce' ),
			),
			'type'      => array(
				'type'        => Type::string(),
				'description' => __( 'Match rows whose target type equals this name.', 'woocommerce' ),
			),
			'field'     => array(
				'type'        => Type::string(),
				'description' => __( 'Match rows whose target field equals this name.', 'woocommerce' ),
			),
			'attribute' => array(
				'type'        => Type::string(),
				'description' => __( 'Match rows whose authorization carries an attribute with this class short name. Surviving rows have their authorization trimmed to the matching descriptors.', 'woocommerce' ),
			),
		),
		'resolve'     => array( self::class, 'resolve' ),
	);
}