Automattic\WooCommerce\Blocks\BlockTypes

ProductFilterActive::get_html_attributes()privateWC 1.0

Build HTML attributes string from assoc array.

Method of the class: ProductFilterActive{}

No Hooks.

Return

String. Escaped HTML attributes string.

Usage

// private - for code of main (parent) class only
$result = $this->get_html_attributes( $attributes );
$attributes(array) (required)
Attributes data as an assoc array.

ProductFilterActive::get_html_attributes() code WC 9.0.1

private function get_html_attributes( $attributes ) {
	return array_reduce(
		array_keys( $attributes ),
		function( $acc, $key ) use ( $attributes ) {
			$acc .= sprintf( ' %1$s="%2$s"', esc_attr( $key ), esc_attr( $attributes[ $key ] ) );
			return $acc;
		},
		''
	);
}