GalleryIdHelper error

Created on 21 April 2022, about 2 years ago
Updated 7 June 2023, about 1 year ago

After updating Colorbox module from 8.1.6 to 8.1.7 etc I have gotten this error:

The website encountered an unexpected error. Please try again later.
TypeError: Argument 2 passed to Drupal\colorbox\GalleryIdHelper::generateId() must implement interface Drupal\Core\Field\FieldItemInterface, instance of Drupal\file\Plugin\Field\FieldType\FileFieldItemList given, called in web/modules/contrib/colorbox/colorbox.theme.inc on line 92 in Drupal\colorbox\GalleryIdHelper->generateId() (line 65 of modules/contrib/colorbox/src/GalleryIdHelper.php).

I still use colorbox module version 8.1.6 because pages that use colorbox module will break.
If I removed web/modules/contrib/colorbox/colorbox.theme.inc line 92 and 155 then this error goes away. But I am really sure this is not the best move and there must be another fix.

Does anybody knows why this is happening?
Drupal core is up-to-date.

πŸ› Bug report
Status

Postponed: needs info

Version

1.10

Component

Code

Created by

πŸ‡¦πŸ‡ΏAzerbaijan ActuallyAM

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡¬πŸ‡·Greece apatrinos

    I've found that changing the prototype of generateId in modules/contrib/colorbox/src/GalleryIdHelper.php to

    public function generateId(ContentEntityInterface $entity, FieldItemListInterface $item, array $settings) 
    

    takes care of the issue.

  • Status changed to Postponed: needs info about 1 year ago
  • πŸ‡ΊπŸ‡ΈUnited States paulmckibben Atlanta, GA

    1. Can you please add steps to reproduce?
    2. Does this bug still exist in the 2.0.x version of the module?

    Thank you.

Production build 0.69.0 2024