Automattic\WooCommerce\Api\Infrastructure

MetadataController::get_target_typeprivate staticWC 1.0

The MetadataTarget output type, lazily built and cached.

Method of the class: MetadataController{}

No Hooks.

Returns

null. Nothing (null).

Usage

$result = MetadataController::get_target_type(): ObjectType;

MetadataController::get_target_type() code WC 10.9.1

private static function get_target_type(): ObjectType {
	if ( null === self::$target_type ) {
		self::$target_type = new ObjectType(
			array(
				'name'        => 'MetadataTarget',
				'description' => __(
					'One element of the schema with its attached metadata. Type-level rows have `field`, `argument` and `enumValue` set to null; field-level rows set `field` (and `argument` when the target is a field argument); enum-value rows set `enumValue`.',
					'woocommerce'
				),
				'fields'      => fn() => array(
					'type'          => array(
						'type'        => Type::nonNull( Type::string() ),
						'description' => __( 'Name of the GraphQL type this row describes.', 'woocommerce' ),
					),
					'field'         => array(
						'type'        => Type::string(),
						'description' => __( 'Field name when this row describes a field (or a field argument); null for type-level rows.', 'woocommerce' ),
					),
					'argument'      => array(
						'type'        => Type::string(),
						'description' => __( 'Argument name when this row describes a field argument; null otherwise.', 'woocommerce' ),
					),
					'enumValue'     => array(
						'type'        => Type::string(),
						'description' => __( 'Enum value name when this row describes one specific enum value; null otherwise.', 'woocommerce' ),
					),
					'entries'       => array(
						'type'        => Type::nonNull( Type::listOf( Type::nonNull( self::get_entry_type() ) ) ),
						'description' => __( 'Metadata entries attached to the target.', 'woocommerce' ),
					),
					'authorization' => array(
						'type'        => Type::nonNull( Type::listOf( Type::nonNull( self::get_auth_entry_type() ) ) ),
						'description' => __( 'Authorization attributes attached to the target (e.g. `RequiredCapability`, `PublicAccess`, or plugin-defined). Empty when the target carries no authorization attributes.', 'woocommerce' ),
					),
				),
			)
		);
	}
	return self::$target_type;
}