Automattic\WooCommerce\Blocks\BlockTypes

ProductImage::parse_attributes()privateWC 1.0

Get the block's attributes.

Метод класса: ProductImage{}

Хуков нет.

Возвращает

Массив. Block attributes merged with defaults.

Использование

// private - только в коде основоного (родительского) класса
$result = $this->parse_attributes( $attributes );
$attributes(массив) (обязательный)
Block attributes.
По умолчанию: empty array

Код ProductImage::parse_attributes() WC 8.7.0

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 );
}