Warning: Undefined array key "admin_title" for hidden element

Created on 1 March 2023, almost 2 years ago
Updated 8 August 2023, over 1 year ago

Problem/Motivation

A warning is logged when adding/editing a "hidden" webform element.

Warning: Undefined array key "admin_title" in webform_validation_webform_element_configuration_form_alter() (line 59 of /var/www/html/web/modules/contrib/webform_validation/webform_validation.module)

Steps to reproduce

The relevant code is:

  $this_element_title = $customProperties['admin_title'] ?: $customProperties['title'];

However, $customProperties does not have an admin_title key for a hidden element.

Proposed resolution

  $this_element_title = !empty($customProperties['admin_title']) ? $customProperties['admin_title'] : $customProperties['title'];

Or, if admin_title should be used if it exists, even if it's an empty string:

  $this_element_title = $customProperties['admin_title'] ?? $customProperties['title'];

Remaining tasks

User interface changes

API changes

Data model changes

🐛 Bug report
Status

Fixed

Version

2.0

Component

Code

Created by

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

Comments & Activities

Production build 0.71.5 2024