Automattic\WooCommerce\Blocks\BlockTypes

CouponCode::has_valid_background_colorprivateWC 1.0

Check if declarations contain a valid CSS background color.

Method of the class: CouponCode{}

No Hooks.

Returns

true|false.

Usage

// private - for code of main (parent) class only
$result = $this->has_valid_background_color( $declarations ): bool;
$declarations(array) (required)
CSS declarations.

CouponCode::has_valid_background_color() code WC 10.8.1

private function has_valid_background_color( array $declarations ): bool {
	if ( empty( $declarations['background-color'] ) ) {
		return false;
	}
	return $this->is_css_color_value( $declarations['background-color'] );
}