Automattic\WooCommerce\Admin\Features\ProductBlockEditor

Init::register_metadata_attribute()publicWC 1.0

Registers the metadata block attribute for all block types. This is a fallback/temporary solution until the Gutenberg core version registers the metadata attribute.

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

Хуков нет.

Возвращает

Массив. $args

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

$Init = new Init();
$Init->register_metadata_attribute( $args );
$args(массив) (обязательный)
Array of arguments for registering a block type.

Заметки

Код Init::register_metadata_attribute() WC 9.7.1

public function register_metadata_attribute( $args ) {
	// Setup attributes if needed.
	if ( ! isset( $args['attributes'] ) || ! is_array( $args['attributes'] ) ) {
		$args['attributes'] = array();
	}

	// Add metadata attribute if it doesn't exist.
	if ( ! array_key_exists( 'metadata', $args['attributes'] ) ) {
		$args['attributes']['metadata'] = array(
			'type' => 'object',
		);
	}

	return $args;
}