Automattic\WooCommerce\Blocks\Utils
MiniCartUtils::migrate_attributes_to_color_panel
Migrate attributes to color panel component format.
Метод класса: MiniCartUtils{}
Хуков нет.
Возвращает
Массив. Reformatted attributes that are compatible with the color panel component.
Использование
$result = MiniCartUtils::migrate_attributes_to_color_panel( $attributes );
- $attributes(массив) (обязательный)
- Any attributes that currently are available from the block.
Код MiniCartUtils::migrate_attributes_to_color_panel() MiniCartUtils::migrate attributes to color panel WC 10.5.0
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;
}