WordPress at a glance
function is not described

register_block_style_handle() WP 5.5.0

Finds a style handle for the block metadata field. It detects when a path to file was provided and registers the style under automatically generated handle name. It returns unprocessed style handle otherwise.

No Hooks.

Return

String|false. Style handle provided directly or created through style's registration, or false on failure.

Usage

register_block_style_handle( $metadata, $field_name );
$metadata(array) (required)
Block metadata.
$field_name(string) (required)
Field name to pick from metadata.

Changelog

Since 5.5.0 Introduced.

Code of register_block_style_handle() WP 5.7.2

<?php
function register_block_style_handle( $metadata, $field_name ) {
	if ( empty( $metadata[ $field_name ] ) ) {
		return false;
	}
	$style_handle = $metadata[ $field_name ];
	$style_path   = remove_block_asset_path_prefix( $metadata[ $field_name ] );
	if ( $style_handle === $style_path ) {
		return $style_handle;
	}

	$style_handle = generate_block_asset_handle( $metadata['name'], $field_name );
	$block_dir    = dirname( $metadata['file'] );
	$style_file   = realpath( "$block_dir/$style_path" );
	$result       = wp_register_style(
		$style_handle,
		plugins_url( $style_path, $metadata['file'] ),
		array(),
		filemtime( $style_file )
	);
	if ( file_exists( str_replace( '.css', '-rtl.css', $style_file ) ) ) {
		wp_style_add_data( $style_handle, 'rtl', 'replace' );
	}

	return $result ? $style_handle : false;
}