Integer BlockComponent inputs (i.e. block settings) are incorrectly saved as strings

Created on 13 August 2025, 1 day ago

Overview

Placing the admin menu block and configuring it to start at level 1 and show 3 levels works and renders and is valid and saves, but … I see this getting stored in the inputs field property for my content-defined component tree:

{"level":"1","depth":"3","expand_all_items":true,"label":"Administration","label_display":"0"}

šŸ› Strings, not integers!

And if I create a Pattern out of it (to create a config-defined component tree):

uuid: d5b012be-b463-46b9-9558-eb88ac87ce7b
langcode: en
status: true
dependencies:
  config:
    - experience_builder.component.block.system_menu_block.admin
id: sadfsadf
label: sadfsadf
component_tree:
  -
    uuid: 0ad04f78-0cb9-4634-9419-6091d1fb4376
    component_id: block.system_menu_block.admin
    component_version: 02b80c9f6cbacff5
    inputs:
      label: Administration
      label_display: '0'
      level: '1'
      depth: '3'
      expand_all_items: true

šŸ› Again strings, not integers!

🤯 I'd expected config schema validation to catch this, but while BlockComponent::validateComponentInput() does call config schema validation, it considers these valid! (Because it does the necessary casting based on the schema.)

Yet if I place the exact same block plugin as a block and use the exact same form to set the same settings, I get the following Block config entity:

uuid: eb9d7af5-d296-4481-a1f7-ddfc106f699d
langcode: en
status: true
dependencies:
  config:
    - system.menu.admin
  module:
    - system
  theme:
    - olivero
id: olivero_administration
theme: olivero
region: header
weight: 0
provider: null
plugin: 'system_menu_block:admin'
settings:
  id: 'system_menu_block:admin'
  label: Administration
  label_display: visible
  provider: system
  level: 1
  depth: 3
  expand_all_items: true
visibility: {  }

šŸ‘† No strings, but integers.

Proposed resolution

Match the observed behavior of Block config entities.

User interface changes

None.

šŸ› Bug report
Status

Active

Version

1.0

Component

Component sources

Created by

šŸ‡§šŸ‡ŖBelgium wim leers Ghent šŸ‡§šŸ‡ŖšŸ‡ŖšŸ‡ŗ

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024