Automattic\WooCommerce\StoreApi\Schemas

ExtendSchema::format_extensions_properties()privateWC 1.0

Format schema for an extension.

Метод класса: ExtendSchema{}

Хуков нет.

Возвращает

Массив. Formatted schema.

Использование

// private - только в коде основоного (родительского) класса
$result = $this->format_extensions_properties( $namespace, $schema, $schema_type );
$namespace(строка) (обязательный)
Error message or \Exception.
$schema(массив) (обязательный)
An error to throw if we have debug enabled and user is admin.
$schema_type(строка) (обязательный)
How should data be shaped.

Код ExtendSchema::format_extensions_properties() WC 8.7.0

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,
	];
}