WordPress at Your Fingertips
function is not described


AbstractBlock::inject_html_data_attributes() protected WC 1.0

Injects block attributes into the block.

{} It's a method of the class: AbstractBlock{}

No Hooks.


String. Rendered block with data attributes.


// protected - for code of main (parent) or child class
$result = $this->inject_html_data_attributes( $content, $attributes );
$content(string) (required)
HTML content to inject into.
$attributes(array) (required)
Key value pairs of attributes.

Code of AbstractBlock::inject_html_data_attributes() WC 5.6.0

protected function inject_html_data_attributes( $content, array $attributes ) {
	return preg_replace( '/<div /', '<div ' . $this->get_html_data_attributes( $attributes ) . ' ', $content, 1 );