Automattic\WooCommerce\Internal\ProductGallery

ProductMediaGallery::get_video_poster_id │ public static │ WC 1.0

Get the poster attachment ID for a gallery video item.

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

Хуков нет.

Возвращает

int.

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

$result = ProductMediaGallery::get_video_poster_id( $media_item ): int;
$media_item(массив) (обязательный)
Product media gallery item.

Код ProductMediaGallery::get_video_poster_id() WC 11.3.0

public static function get_video_poster_id( array $media_item ): int {
	$poster_id = isset( $media_item['poster_id'] ) ? absint( $media_item['poster_id'] ) : 0;

	if ( $poster_id ) {
		return $poster_id;
	}

	$attachment_id = isset( $media_item['id'] ) ? absint( $media_item['id'] ) : 0;

	return $attachment_id ? (int) get_post_thumbnail_id( $attachment_id ) : 0;
}