Problem/Motivation

The module's shipped default configuration is orphaned — no code reads it. The image component therefore has no upload folder and no file-extension validation until an administrator happens to visit and save the settings form.

config/install/layout_builder_kit.settings.yml ships flat keys:

image_location: 'layout_builder_kit'
image_extensions: 'gif png jpg jpeg webp'

But the code reads a different config object, with nested keys:

src/Form/LayoutBuilderKitSettingsForm.php:18,33,63
    'layout_builder_kit.image_component' -> get('layout_builder_kit.image_location')

src/Plugin/Block/LBKImage/LBKImage.php:129,130,152
    'layout_builder_kit.image_component' -> get('layout_builder_kit.image_location')
                                         -> get('layout_builder_kit.image_extensions')

Verified on a clean Drupal 12 install with the module enabled:

layout_builder_kit.settings        => {"image_location":"layout_builder_kit","image_extensions":"gif png jpg jpeg webp"}
layout_builder_kit.image_component => []
LBKImage image_location            => NULL

So LBKImage builds its managed_file element with a NULL upload location and 'file_validate_extensions' => [NULL].

config/schema/layout_builder_kit.schema.yml declares both config objects, so the schema is not at fault — the install default is under the wrong name and the wrong key shape.

Root cause

Two commits disagree:

  • fd721c2 (issue 3514048) renamed the config to layout_builder_kit.settings and flattened the keys, updating both the YAML and the settings form.
  • 4ef7712 then changed the form back to layout_builder_kit.image_component with nested keys, but left the YAML renamed.

The two halves have been inconsistent since March 2025. Both the 3.0.x and 4.0.x branches are affected identically.

Steps to reproduce

  1. Install the module on a clean site.
  2. Do not visit /admin/config/content/layout-builder-kit.
  3. Place an Image (LBK) block in Layout Builder.
  4. The upload destination is unset and no extension restriction is applied. drush php:eval confirms layout_builder_kit.image_component is an empty config object.

Proposed resolution

  1. Standardise on a single config name and key shape. layout_builder_kit.settings with flat keys is the more idiomatic choice and matches what already ships.
  2. Make the settings form, LBKImage, the schema and config/install agree.
  3. Add a hook_update_N migrating any existing layout_builder_kit.image_component values into the chosen config. Existing sites will have that object, because saving the settings form creates it — administrator-configured values must not be dropped.
  4. Audit every other config read in the module for the same mismatch.
  5. Add Kernel coverage asserting the defaults are readable immediately after install, without saving the form, and that file_validate_extensions is non-NULL.

Remaining tasks

  • Merge requests for 3.0.x and 4.0.x (3.0.x must keep working on Drupal 10).
  • Review whether the layout_builder_kit.image_component schema entry should be removed once the update path has run.

Comments

aangel created an issue. See original summary.

aangel’s picture

Issue summary: View changes

  • aangel committed 9cd6a4cb on 4.0.x
    Issue #3614068: Read the image settings the module actually ships
    

  • aangel committed a2ff2bfb on 3.0.x
    Issue #3614068: Read the image settings the module actually ships (3.0.x...
aangel’s picture

Status: Active » 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.

Status: Fixed » Closed (fixed)

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