Automattic\WooCommerce\Blocks\BlockTypes
MiniCart::modify_hooked_block_attributes()
Callback for the Block Hooks API to modify the attributes of the hooked block.
Метод класса: MiniCart{}
Хуков нет.
Возвращает
Массив|null
.
Использование
$MiniCart = new MiniCart(); $MiniCart->modify_hooked_block_attributes( $parsed_hooked_block, $hooked_block_type, $relative_position, $parsed_anchor_block, $context );
- $parsed_hooked_block(массив|null) (обязательный)
- The parsed block array for the given hooked block type, or null to suppress the block.
- $hooked_block_type(строка) (обязательный)
- The hooked block type name.
- $relative_position(строка) (обязательный)
- The relative position of the hooked block.
- $parsed_anchor_block(массив) (обязательный)
- The anchor block, in parsed block array format.
- $context(WP_Block_Template|WP_Post|массив) (обязательный)
- The block template, template part, wp_navigation post type, or pattern that the anchor block belongs to.
Код MiniCart::modify_hooked_block_attributes() MiniCart::modify hooked block attributes WC 9.7.1
public function modify_hooked_block_attributes( $parsed_hooked_block, $hooked_block_type, $relative_position, $parsed_anchor_block, $context ) { $mini_cart_block_font_size = wp_get_global_styles( array( 'blocks', 'woocommerce/mini-cart', 'typography', 'fontSize' ) ); if ( ! is_string( $mini_cart_block_font_size ) ) { $navigation_block_font_size = wp_get_global_styles( array( 'blocks', 'core/navigation', 'typography', 'fontSize' ) ); if ( is_string( $navigation_block_font_size ) ) { $parsed_hooked_block['attrs']['style']['typography']['fontSize'] = $navigation_block_font_size; } } return $parsed_hooked_block; }