WC_Brands::configure_product_brand_block
Configures the attributes for the hooked product brand terms block.
Method of the class: WC_Brands{}
No Hooks.
Returns
Array. The parsed hooked block.
Usage
$WC_Brands = new WC_Brands(); $WC_Brands->configure_product_brand_block( $parsed_hooked_block, $hooked_block_type, $relative_position, $parsed_anchor_block, $context );
- $parsed_hooked_block(array) (required)
- The parsed hooked block.
- $hooked_block_type(string) (required)
- The type of hooked block.
- $relative_position(int) (required)
- The relative position of the hooked block.
- $parsed_anchor_block(array) (required)
- The parsed anchor block.
- $context(WP_Block_Template) (required)
- The context of the block.
WC_Brands::configure_product_brand_block() WC Brands::configure product brand block code WC 10.4.3
public function configure_product_brand_block( $parsed_hooked_block, $hooked_block_type, $relative_position, $parsed_anchor_block, $context ) {
if ( is_null( $parsed_hooked_block ) ) {
return $parsed_hooked_block;
}
if ( 'core/post-terms' === $hooked_block_type &&
'last_child' === $relative_position &&
'woocommerce/product-meta' === $parsed_anchor_block['blockName'] &&
empty( $parsed_anchor_block['attrs'] ) ) {
$parsed_hooked_block['attrs'] = array(
'term' => 'product_brand',
'prefix' => __( 'Brands: ', 'woocommerce' ),
);
}
return $parsed_hooked_block;
}