Automattic\WooCommerce\Blocks\BlockTypes

ProductImage::parse_attributes()privateWC 1.0

Get the block's attributes.

Method of the class: ProductImage{}

No Hooks.

Return

Array. Block attributes merged with defaults.

Usage

// private - for code of main (parent) class only
$result = $this->parse_attributes( $attributes );
$attributes(array) (required)
Block attributes.
Default: empty array

ProductImage::parse_attributes() code WC 9.8.2

private function parse_attributes( $attributes ) {
	// These should match what's set in JS `registerBlockType`.
	$defaults = array(
		'showProductLink'         => true,
		'showSaleBadge'           => true,
		'saleBadgeAlign'          => 'right',
		'imageSizing'             => 'single',
		'productId'               => 'number',
		'isDescendentOfQueryLoop' => 'false',
		'scale'                   => 'cover',
	);

	return wp_parse_args( $attributes, $defaults );
}