Automattic\WooCommerce\Blocks\BlockTypes
CustomerAccount::modify_hooked_block_attributes
Callback for the Block Hooks API to modify the attributes of the hooked block.
Method of the class: CustomerAccount{}
No Hooks.
Returns
Array|null
.
Usage
$CustomerAccount = new CustomerAccount(); $CustomerAccount->modify_hooked_block_attributes( $parsed_hooked_block, $hooked_block_type, $relative_position, $parsed_anchor_block, $context );
- $parsed_hooked_block(array|null) (required)
- The parsed block array for the given hooked block type, or null to suppress the block.
- $hooked_block_type(string) (required)
- The hooked block type name.
- $relative_position(string) (required)
- The relative position of the hooked block.
- $parsed_anchor_block(array) (required)
- The anchor block, in parsed block array format.
- $context(WP_Block_Template|WP_Post|array) (required)
- The block template, template part, wp_navigation post type, or pattern that the anchor block belongs to.
CustomerAccount::modify_hooked_block_attributes() CustomerAccount::modify hooked block attributes code WC 9.9.4
public function modify_hooked_block_attributes( $parsed_hooked_block, $hooked_block_type, $relative_position, $parsed_anchor_block, $context ) { $parsed_hooked_block['attrs']['displayStyle'] = 'icon_only'; $parsed_hooked_block['attrs']['iconStyle'] = 'line'; $parsed_hooked_block['attrs']['iconClass'] = 'wc-block-customer-account__account-icon'; $customer_account_block_font_size = wp_get_global_styles( array( 'blocks', 'woocommerce/customer-account', 'typography', 'fontSize' ) ); if ( ! is_string( $customer_account_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; }