Notice: Undefined index: #name

Created on 20 January 2021, over 3 years ago
Updated 25 June 2024, 2 days ago

Problem/Motivation

If a form widget contains an element that does not have a #name key (for example, a container), it triggers this notice:

Notice: Undefined index: #name
in ConditionalFieldsFormHelper.php line 192

Steps to reproduce

/**
 * @param $form
 */
function mymodule_form_alter(&$form) {
  $form['field_my_field']['widget'][0]['foo'] = [
    '#type' => 'container',
    'bar' => [],
  ];
}

Proposed resolution

ConditionalFieldsFormHelper::getState() should check if the #name key exists.

Remaining tasks

I will submit a patch.

πŸ› Bug report
Status

RTBC

Version

4.0

Component

Code

Created by

πŸ‡«πŸ‡·France prudloff Lille

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

Merge Requests

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.69.0 2024