Automattic\WooCommerce\Blocks\AIContent

UpdatePatterns::get_selected_image_format()privateWC 1.0

Returns the selected image format. Defaults to portrait.

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

Хуков нет.

Возвращает

Строку. The selected image format.

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

// private - только в коде основоного (родительского) класса
$result = $this->get_selected_image_format( $selected_image );
$selected_image(массив) (обязательный)
The selected image to be assigned to the pattern.

Код UpdatePatterns::get_selected_image_format() WC 9.4.2

private function get_selected_image_format( $selected_image ) {
	if ( ! isset( $selected_image['width'], $selected_image['height'] ) ) {
		return 'portrait';
	}

	return $selected_image['width'] === $selected_image['height'] ? 'square' : ( $selected_image['width'] > $selected_image['height'] ? 'landscape' : 'portrait' );
}