WC_Settings_API::get_custom_attribute_html()publicWC 1.0

Get custom attributes.

Method of the class: WC_Settings_API{}

No Hooks.

Return

String.

Usage

$WC_Settings_API = new WC_Settings_API();
$WC_Settings_API->get_custom_attribute_html( $data );
$data(array) (required)
Field data.

WC_Settings_API::get_custom_attribute_html() code WC 8.7.0

public function get_custom_attribute_html( $data ) {
	$custom_attributes = array();

	if ( ! empty( $data['custom_attributes'] ) && is_array( $data['custom_attributes'] ) ) {
		foreach ( $data['custom_attributes'] as $attribute => $attribute_value ) {
			$custom_attributes[] = esc_attr( $attribute ) . '="' . esc_attr( $attribute_value ) . '"';
		}
	}

	return implode( ' ', $custom_attributes );
}