Empty vertical tabs when mapping schema type overwrites field schema mappings

Created on 15 May 2025, 5 months ago

When using schema-based config forms with vertical tabs, the tabs appear empty due to an array merge operation that overwrites field schema mappings with generic type schema information.

Problem/Motivation

When building form elements for a mapping type, the module merges type schema with field schema using:

$mapping_schema = $type_schema + $field_schema;

This causes the generic type schema's empty `mapping` array to overwrite the field schema's `mapping` array that contains the actual tab content, resulting in empty vertical tabs in the form.

Steps to reproduce

1. Create a config schema using mapping types for vertical tabs structure
2. Define content inside the mappings for each tab
3. Create a form extending SchemaBasedConfigForms' ConfigFormBase
4. Access the form

Current behavior:
- Vertical tabs are rendered but appear empty
- The tab content defined in the field schema mappings is lost

Expected behavior:
- Vertical tabs should display their content as defined in the field schema mappings

Proposed resolution

Invert the array merge operation to preserve field schema mappings:

$mapping_schema = $field_schema + $type_schema;

This ensures that specific field schema definitions take precedence over generic type schema information.

Related code:

// In schema_based_config_forms/src/Form/ConfigFormBase.php, line 185:
$mapping_schema = $type_schema + $field_schema;  // Current
$mapping_schema = $field_schema + $type_schema;  // Proposed
πŸ› Bug report
Status

Active

Version

1.0

Component

Code

Created by

πŸ‡§πŸ‡·Brazil halth Brazil

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

Merge Requests

Comments & Activities

Production build 0.71.5 2024