Undefined array key "#markup" in Drupal\config_translation\FormElement\ListElement->getGroupTitle()

Created on 18 November 2024, 3 months ago

Problem/Motivation

A Warning is thrown when the translation is enabled for a config form and one of the form elements key contains the string "title" or "label"

Steps to reproduce

  • Create a custom config form with the following element :
     $form['section_title'] = [
            '#type' => 'text_format',
            '#title' => 'Section Title',
            '#allowed_formats' => ['title_html'],
            '#format' => 'title_html',
            '#description' => $this->t('Enter the title here.'),
            '#description_display' => 'before',
            '#default_value' => $config->get("section_title")['value'] ?? '',
            '#required' => TRUE,
          ];
  • Add Schema file for the same
    mapping:
                section_title:
                  type: text_format
                  label: 'Section Title'
  • Now try to submit the translation form you'll see the warning above the form elements

Proposed resolution

Add a check if "#markup" exists in the source of the element before assigning to title.

๐Ÿ› Bug report
Status

Active

Version

10.5 โœจ

Component

configuration system

Created by

๐Ÿ‡ฎ๐Ÿ‡ณIndia Lokeshwari

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