Automattic\WooCommerce\Blocks\Templates

ArchiveProductTemplatesCompatibility::inject_attribute()privateWC 1.0

Recursively inject the custom attribute to all nested blocks.

Method of the class: ArchiveProductTemplatesCompatibility{}

No Hooks.

Return

null. Nothing (null).

Usage

// private - for code of main (parent) class only
$result = $this->inject_attribute( $block );
$block(array) (required) (passed by reference — &)
Parsed block data.

ArchiveProductTemplatesCompatibility::inject_attribute() code WC 9.0.1

private function inject_attribute( &$block ) {
	$block['attrs']['isInherited'] = 1;

	if ( ! empty( $block['innerBlocks'] ) ) {
		array_walk( $block['innerBlocks'], array( $this, 'inject_attribute' ) );
	}
}