Problem/Motivation

I'm getting the following error using version 1.3.6 and Drupal Core 10.3.13 attempting to access the settings page at: /admin/config/content/layout_builder_iframe_modal.

This appears to occur when the default 'install' config does not for whatever reason import. It would be good to have a fallback to either default settings here or to at least show the form without values rather than this error:

The website encountered an unexpected error. Try again later.

TypeError: implode(): Argument #1 ($array) must be of type array, string given in implode() (line 74 of modules/contrib/layout_builder_iframe_modal/src/Form/LayoutBuilderIframeModalSettingsForm.php).

Steps to reproduce

Install layout_builder_iframe_modal version 1.3.6 on Drupal Core 10.3.13. Attempt to adjust settings at

Install version 1.3.6 on Drupal Core 10.3.13 and attempt to visit the settings page at /admin/config/content/layout_builder_iframe_modal

Error should appear.

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

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

brooke_heaton created an issue. See original summary.

brooke_heaton’s picture

Issue summary: View changes
dhruv.mittal’s picture

Assigned: Unassigned » dhruv.mittal
svendecabooter’s picture

Did you update from a previous version?
If so, did you run update.php or "drush updb"?

svendecabooter’s picture

Status: Active » Postponed (maintainer needs more info)
dhruv.mittal’s picture

Assigned: dhruv.mittal » Unassigned

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

aarnau’s picture

Status: Postponed (maintainer needs more info) » Needs review
svendecabooter’s picture

Status: Needs review » Postponed (maintainer needs more info)

The value is expected to always be an array, either through import of the config via /config/install, or for existing sites, by running database updates. Specifically layout_builder_iframe_modal.post_update.php method layout_builder_iframe_modal_post_update_custom_routes_config() should make this an array, if it isn't already.

dan612’s picture

I think this error can be encountered by doing:

  1. Have a version installed without the custom_routes config
  2. Export configuration based on this version
  3. Update module to a version that includes custom_routes, but do not run updates locally. This means you will also not export config with the updates.
  4. Deploy updated version of module to site, run database updates
  5. Import configuration, which should now revert/overwrite the config put in place by the db update

A quick fix would be to add the custom_routes key to the layout_builder_iframe_modal.settings :

custom_routes: {  }

then import configuration.

svendecabooter’s picture

svendecabooter’s picture

Status: Postponed (maintainer needs more info) » Needs review

That seems more like an issue of a bad workflow regarding config management...
But the proposed fix is fairly straight forward, so will add it as an extra safeguard.

svendecabooter’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

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