Generates the name for an asset based on the name of the block and the field name provided.
Parameters
$block_namestring
Name of the block.
$field_namestring
Name of the metadata field.
$indexintoptional
Index of the asset when multiple items passed. Default 0.Default: 0
Return
string
Generated asset name for the block's field.
Uses · 2
str_starts_with()Polyfill for `str_starts_with()` function added in PHP 8.0.
str_ends_with()Polyfill for `str_ends_with()` function added in PHP 8.0.
Used by · 4
enqueue_block_styles_assets()Function responsible for enqueuing the styles required for block styles functionality on the editor and on the frontend.
register_block_script_handle()Finds a script handle for the selected block metadata field. It detects when a path to file was provided and optionally finds a corresponding asset file with details necessary to register the script under automatically generated handle name. It returns unprocessed script handle otherwise.
register_block_script_module_id()Finds a script module ID for the selected block metadata field. It detects when a path to file was provided and optionally finds a corresponding asset file with details necessary to register the script module under with an automatically generated module ID. It returns unprocessed script module ID otherwise.
register_block_style_handle()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.
Signature, return type and hooks compared across 5 parsed releases.
6.5.0
Added support for viewScriptModule field.from the docblock
6.1.0
Added $index parameter.from the docblock
5.5.0
Introduced.from the docblock
About this page
Parsed data
Generated from the wordpress-develop 6.7.7 tag, from src/wp-includes/blocks.php, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it.
Corrections
Something wrong on this page? Report it and it gets fixed in the next regeneration.