wpseek.com
A WordPress-centric search engine for devs and theme authors
generate_block_asset_handle › WordPress Function
Since5.5.0
Deprecatedn/a
› generate_block_asset_handle ( $block_name, $field_name )
Parameters: (2) |
|
Returns: |
|
Defined at: |
|
Codex: |
Generates the name for an asset based on the name of the block and the field name provided.
Source
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 ]; }