Automattic\WooCommerce\EmailEditor\Integrations\Utils

Table_Wrapper_Helper::build_attributes_string │ private static │ WC 1.0

Build an HTML attributes string from an array.

Method of the class: Table_Wrapper_Helper{}

No Hooks.

Returns

string. The attributes string.

Usage

$result = Table_Wrapper_Helper::build_attributes_string( $attributes ): string;
$attributes(array<string, string>) (required)
The attributes array.

Table_Wrapper_Helper::build_attributes_string() code WC 11.1.2

private static function build_attributes_string( array $attributes ): string {
	$attr_parts = array();
	foreach ( $attributes as $key => $value ) {
		if ( '' !== $value ) {
			$attr_parts[] = sprintf( '%s="%s"', $key, esc_attr( $value ) );
		}
	}
	return implode( ' ', $attr_parts );
}