Hi,

I just upgraded the module to Version 2 via composer. Now I get the following error message:

"Warning: Invalid argument supplied for foreach() in lazy_is_enabled() (line 130 of modules/contrib/lazy/lazy.module)."

I am working on Windows 10, with Lando and Docker [18.06.1-ce-win73 (19507)]. Drupal is the newest Version 8.7.0.

Can you help me with this error?

If you need more information about my system or settings, please let me know!

Thank you!

Comments

Anonymous’s picture

jds23 created an issue. See original summary.

Anonymous’s picture

Assigned: » Unassigned
dbgilbert’s picture

Looks like the issue is that the $image_fields config value is a boolean where the code expects an array. This makes sense given that the update to 2.0 changed the option from a single global switch to an array of switches for each image field. Seems like there should have been an update function in the .install file to handle the transition from 1.x to 2.0.

It seems relatively easy to resolve manually, however. If you find the lazy.settings config file (the one in your export directory, not the one in the module directory) you can manually change the image_fields value from true/false to an empty array [] and then run config import via drush. You may still see warnings but I was able to load pages at least, and access /admin/config/content/lazy to save a new config and pick up any other new config values.

osman’s picture

Version: 8.x-2.0 » 8.x-2.x-dev
Assigned: Unassigned » osman

  • osman committed 1da7413 on 8.x-2.x
    git commit -m 'Issue #3052771 by osman: Upgrade v1 -> v2: Warning:...
osman’s picture

Status: Active » Needs review

This update fixes two issues which are experienced during an upgrade from 8.x-1.x to 8.x-2.x:

Previously the image fields option was a global switch for all image fields from all entities. As of 8.x-2.x, the image fields can be managed now individually in the image's format settings at the Manage Display pages.

Since there is now more flexibility, I opted not to enable lazy-loading for every single image field. You should enable the fields you need.

As of 8.x-2.x, there is also a new feature: Disabled Pages; where you can define all the paths that should not have lazy-loading enabled at all. The upgrade would omit the default value /rss.xml and keep the field empty.

osman’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.