Automattic\WooCommerce\StoreApi\Schemas
ExtendSchema::format_extensions_properties
Format schema for an extension.
Method of the class: ExtendSchema{}
No Hooks.
Returns
Array. Formatted schema.
Usage
// private - for code of main (parent) class only $result = $this->format_extensions_properties( $namespace, $schema, $schema_type );
- $namespace(string) (required)
- Error message or \Exception.
- $schema(array) (required)
- An error to throw if we have debug enabled and user is admin.
- $schema_type(string) (required)
- How should data be shaped.
ExtendSchema::format_extensions_properties() ExtendSchema::format extensions properties code WC 10.3.3
private function format_extensions_properties( $namespace, $schema, $schema_type ) {
if ( ARRAY_N === $schema_type ) {
return [
/* translators: %s: extension namespace */
'description' => sprintf( __( 'Extension data registered by %s', 'woocommerce' ), $namespace ),
'type' => [ 'array', 'null' ],
'context' => [ 'view', 'edit' ],
'items' => $schema,
];
}
return [
/* translators: %s: extension namespace */
'description' => sprintf( __( 'Extension data registered by %s', 'woocommerce' ), $namespace ),
'type' => [ 'object', 'null' ],
'context' => [ 'view', 'edit' ],
'properties' => $schema,
];
}