acf_enqueue_block_type_assets()
Enqueues scripts and styles for a specific block type.
Хуков нет.
Возвращает
null. Ничего (null).
Использование
acf_enqueue_block_type_assets( $block_type );
- $block_type(массив) (обязательный)
- The block type settings.
Список изменений
| С версии 5.7.13 | Введена. |
Код acf_enqueue_block_type_assets() acf enqueue block type assets ACF 6.4.2
function acf_enqueue_block_type_assets( $block_type ) {
// Generate handle from name.
$handle = 'block-' . acf_slugify( $block_type['name'] );
// Enqueue style.
if ( $block_type['enqueue_style'] ) {
wp_enqueue_style( $handle, $block_type['enqueue_style'], array(), ACF_VERSION, 'all' );
}
// Enqueue script.
if ( $block_type['enqueue_script'] ) {
wp_enqueue_script( $handle, $block_type['enqueue_script'], array(), ACF_VERSION, true );
}
// Enqueue assets callback.
if ( $block_type['enqueue_assets'] && is_callable( $block_type['enqueue_assets'] ) ) {
call_user_func( $block_type['enqueue_assets'], $block_type );
}
}