WordPress at Your Fingertips
function is not described

generate_block_asset_handle() WP 5.5.0

Generates the name for an asset based on the name of the block and the field name provided.

No Hooks.

Return

String. Generated asset name for the block's field.

Usage

generate_block_asset_handle( $block_name, $field_name );
$block_name(string) (required)
Name of the block.
$field_name(string) (required)
Name of the metadata field.

Code of generate_block_asset_handle() WP 5.8.3

function generate_block_asset_handle( $block_name, $field_name ) {
	if ( 0 === strpos( $block_name, 'core/' ) ) {
		$asset_handle = str_replace( 'core/', 'wp-block-', $block_name );
		if ( 0 === strpos( $field_name, 'editor' ) ) {
			$asset_handle .= '-editor';
		}
		return $asset_handle;
	}

	$field_mappings = array(
		'editorScript' => 'editor-script',
		'script'       => 'script',
		'editorStyle'  => 'editor-style',
		'style'        => 'style',
	);
	return str_replace( '/', '-', $block_name ) .
		'-' . $field_mappings[ $field_name ];
}