Problem/Motivation

Both image formatters declare the module-handler and library-discovery services as private. Their inherited DependencySerializationTrait cannot restore these properties after serialization. Calling settingsForm() afterward fails with Call to a member function moduleExists() on null.

Steps to reproduce

  1. Create a GLightbox or GLightbox Responsive formatter through the formatter plugin manager.
  2. Serialize and unserialize the formatter.
  3. Call settingsForm() on the restored formatter. Both injected services are null, and the call fails.

Proposed resolution

Change the four service properties to protected, following Drupal's serialization guidance. Add a regression test covering both formatters.

Locally tested on Drupal 10 and 11: the regression test fails before the fix and passes afterward.

Remaining tasks

Review and merge the MR.

Issue fork glightbox-3628779

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

nick hope created an issue. See original summary.

nick hope’s picture

Assigned: nick hope » Unassigned
Issue summary: View changes
Status: Active » Needs review

levmyshkin made their first commit to this issue’s fork.

levmyshkin’s picture

Status: Needs review » Fixed

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

levmyshkin’s picture

Status: Fixed » Closed (fixed)