Automattic\WooCommerce\Blocks\Utils
MiniCartUtils::migrate_attributes_to_color_panel()
Migrate attributes to color panel component format.
Method of the class: MiniCartUtils{}
No Hooks.
Return
Array
. Reformatted attributes that are compatible with the color panel component.
Usage
$result = MiniCartUtils::migrate_attributes_to_color_panel( $attributes );
- $attributes(array) (required)
- Any attributes that currently are available from the block.
MiniCartUtils::migrate_attributes_to_color_panel() MiniCartUtils::migrate attributes to color panel code WC 9.4.2
public static function migrate_attributes_to_color_panel( $attributes ) { if ( isset( $attributes['priceColorValue'] ) && ! isset( $attributes['priceColor'] ) ) { $attributes['priceColor'] = array( 'color' => $attributes['priceColorValue'], ); unset( $attributes['priceColorValue'] ); } if ( isset( $attributes['iconColorValue'] ) && ! isset( $attributes['iconColor'] ) ) { $attributes['iconColor'] = array( 'color' => $attributes['iconColorValue'], ); unset( $attributes['iconColorValue'] ); } if ( isset( $attributes['productCountColorValue'] ) && ! isset( $attributes['productCountColor'] ) ) { $attributes['productCountColor'] = array( 'color' => $attributes['productCountColorValue'], ); unset( $attributes['productCountColorValue'] ); } return $attributes; }