__experimental_woocommerce_blocks_add_data_attributes_to_block хук-фильтрWC 5.9.0

Filters the list of allowed Block Names

This hook defines which block names should have block name and attribute data- attributes appended on render.

Использование

add_filter( '__experimental_woocommerce_blocks_add_data_attributes_to_block', 'wp_kama__experimental_woocommerce_blocks_add_data_attributes_to_block_filter' );

/**
 * Function for `__experimental_woocommerce_blocks_add_data_attributes_to_block` filter-hook.
 * 
 * @param array $allowed_namespaces List of namespaces.
 *
 * @return array
 */
function wp_kama__experimental_woocommerce_blocks_add_data_attributes_to_block_filter( $allowed_namespaces ){

	// filter...
	return $allowed_namespaces;
}
$allowed_namespaces(массив)
List of namespaces.

Список изменений

С версии 5.9.0 Введена.

Где вызывается хук

BlockTypesController::block_should_have_data_attributes()
__experimental_woocommerce_blocks_add_data_attributes_to_block
woocommerce/src/Blocks/BlockTypesController.php 212
$allowed_blocks = (array) apply_filters( '__experimental_woocommerce_blocks_add_data_attributes_to_block', array() );

Где используется хук в WooCommerce

Использование не найдено.