Automattic\WooCommerce\Internal\ProductGallery

ProductMediaGallery::resolve_video_poster_ids │ private static │ WC 1.0

Resolve poster IDs for video items.

Method of the class: ProductMediaGallery{}

No Hooks.

Returns

array.

Usage

$result = ProductMediaGallery::resolve_video_poster_ids( $media_gallery ): array;
$media_gallery(array) (required)
Media gallery items.

ProductMediaGallery::resolve_video_poster_ids() code WC 11.1.2

private static function resolve_video_poster_ids( array $media_gallery ): array {
	foreach ( $media_gallery as $index => $media_item ) {
		if ( ! is_array( $media_item ) || 'video' !== ( $media_item['media_type'] ?? '' ) ) {
			continue;
		}

		$poster_id = self::get_video_poster_id( $media_item );

		if ( $poster_id ) {
			$media_gallery[ $index ]['poster_id'] = $poster_id;
		}
	}

	return $media_gallery;
}