Issue Summary:
When using Lightgallery in Drupal to display a gallery of images, an additional "undefined" image is loaded alongside the existing images. This problem occurs to me constantly no matter the number of images.
Steps to Reproduce:
I am using commerce and a multiple image field type on commerce product variation.
Upload multiple images to the image field.
Have this kind of conifguration on image field type:
- Field:
langcode: en
status: true
dependencies:
config:
- commerce_product.commerce_product_variation_type.default
- field.storage.commerce_product_variation.field_image
module:
- image
id: commerce_product_variation.default.field_image
field_name: field_image
entity_type: commerce_product_variation
bundle: default
label: Image
description: ''
required: true
translatable: false
default_value: { }
default_value_callback: ''
settings:
handler: 'default:file'
handler_settings: { }
file_directory: product/images
file_extensions: 'png gif jpg jpeg'
max_filesize: ''
max_resolution: ''
min_resolution: ''
alt_field: true
alt_field_required: true
title_field: true
title_field_required: false
default_image:
uuid: 09b9cb9f-4da5-4145-9657-f3df7d58065f
alt: default-image
title: default-image
width: 1000
height: 1000
field_type: image
- Field storage:
langcode: en
status: true
dependencies:
module:
- commerce_product
- file
- image
id: commerce_product_variation.field_image
field_name: field_image
entity_type: commerce_product_variation
type: image
settings:
target_type: file
display_field: false
display_default: false
uri_scheme: public
default_image:
uuid: b69aefc3-a735-44a4-b8db-6054cd8c49bd
alt: default-image
title: default-image
width: 1000
height: 1000
module: image
locked: false
cardinality: -1
translatable: true
indexes: { }
persist_with_no_fields: false
custom_storage: false
- Entity view display:
field_image:
type: lightgallery
label: hidden
settings:
lightgallery_core:
thumb_image_style: product
lightgallery_image_style: ''
title_source: title
closable: 1
mode: 0
preload: 1
loop: 1
esc_key: 1
key_press: 1
controls: 1
mouse_wheel: 1
download: 1
counter: 1
drag: 1
touch: 1
lightgallery_thumbs:
thumbnails: 0
animate_thumb: 1
current_pager_position: middle
thumb_width: '100'
thumb_cont_height: '100'
lightgallery_autoplay:
autoplay: 1
pause: '5000'
progress_bar: '1'
autoplay_controls: '1'
lightgallery_full_screen:
full_screen: 1
lightgallery_pager:
pager: 1
lightgallery_zoom:
zoom: 1
scale: '1'
lightgallery_hash:
hash: 1
gallery_id: '1'
View the page.
Expected Behavior:
The Lightgallery should display only the images that are part of the gallery, and not with the additional undefined image.
Actual Behavior:
It is always displaying additional undefined image.
Log message:
Failed to load resource: the server responded with a status of 404 (Not Found)
lightgallery.min.js?sazyx1:4 lightGallery :- data-src is not pvovided on slide item 8. Please make sure the selector property is properly configured. More info - http://sachinchoolur.github.io/lightGallery/demos/html-markup.html
b.isVideo @ lightgallery.min.js?sazyx1:4
Proposed resolution:
In ligthallery-all.js file from in function getThumb on line 1947 add type check on variable thumb.
Versions of modules:
Drupal core: 10.2.4
Drupal commerce: 2.38.0
Drupal lightgallery: 1.4
Lightgallery library sachinchoolur/lightgallery: 1.6.11
I am attaching images that prove this behaviour