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 tolayout_builder_kit.settingsand flattened the keys, updating both the YAML and the settings form.4ef7712then changed the form back tolayout_builder_kit.image_componentwith 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
- Install the module on a clean site.
- Do not visit /admin/config/content/layout-builder-kit.
- Place an Image (LBK) block in Layout Builder.
- The upload destination is unset and no extension restriction is applied.
drush php:evalconfirmslayout_builder_kit.image_componentis an empty config object.
Proposed resolution
- Standardise on a single config name and key shape.
layout_builder_kit.settingswith flat keys is the more idiomatic choice and matches what already ships. - Make the settings form,
LBKImage, the schema andconfig/installagree. - Add a
hook_update_Nmigrating any existinglayout_builder_kit.image_componentvalues into the chosen config. Existing sites will have that object, because saving the settings form creates it — administrator-configured values must not be dropped. - Audit every other config read in the module for the same mismatch.
- Add Kernel coverage asserting the defaults are readable immediately after install, without saving the form, and that
file_validate_extensionsis 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_componentschema entry should be removed once the update path has run.
Comments
Comment #2
aangel commentedComment #5
aangel commented