Custom Settings for date format should be removed when a field switches to "Date List"

Created on 19 April 2023, over 1 year ago
Updated 14 June 2023, over 1 year ago

Problem/Motivation

If settings for datepicker date formatting (see below for example) have been added to a date field under Edit -> Advanced -> Custom Settings -> Custom Properties, they will still be there if the field is set to "Date List". As of the upgrade to webform 6.2.0-beta5, we've been getting the following warning on forms with this setting:

Warning: Undefined array key "#date_time_element" in template_preprocess_datetime_form() (line 577 of /var/www/html/docroot/core/includes/theme.inc)
#0 /var/www/html/docroot/core/includes/bootstrap.inc(347): _drupal_error_handler_real()
#1 /var/www/html/docroot/core/includes/theme.inc(577): _drupal_error_handler()
#2 [internal function]: template_preprocess_datetime_form()
#3 /var/www/html/docroot/core/lib/Drupal/Core/Theme/ThemeManager.php(287): call_user_func_array()
#4 /var/www/html/docroot/core/lib/Drupal/Core/Render/Renderer.php(433): Drupal\Core\Theme\ThemeManager->render()
#5 /var/www/html/docroot/core/lib/Drupal/Core/Render/Renderer.php(446): Drupal\Core\Render\Renderer->doRender()
#6 /var/www/html/docroot/core/lib/Drupal/Core/Render/Renderer.php(446): Drupal\Core\Render\Renderer->doRender()
#7 /var/www/html/docroot/core/lib/Drupal/Core/Render/Renderer.php(446): Drupal\Core\Render\Renderer->doRender()
#8 /var/www/html/docroot/core/lib/Drupal/Core/Render/Renderer.php(204): Drupal\Core\Render\Renderer->doRender().... truncated

Steps to reproduce

- Enable Webform 6.1.x
- Create a webform with a date field using a datepicker and date format
- Switch to Date List
- Upgrade to Webform 6.2.0-beta5
- Check webform for warning

Example of advanced settings causing problems:

datepicker: true
date_date_format: m/d/Y

Proposed resolution

- Update script that removes datepicker settings on date list fields
- Logic that removes datepicker settings when a date field is changed to a date list

🐛 Bug report
Status

Fixed

Version

6.2

Component

Code

Created by

🇺🇸United States loopy1492

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

Comments & Activities

Production build 0.71.5 2024