Problem/Motivation
Reopening the original #3483466: Recurring date validation targets undefined form elements issue since the issue is still not fixed.
Warning: Undefined array key "time_wrapper" in Drupal\smart_date_recur\Entity\SmartDateRule::validateRecurring() (line 1007 of /var/www/html/web/modules/contrib/smart_date/modules/smart_date_recur/src/Entity/SmartDateRule.php).
Warning: Trying to access array offset on null in Drupal\smart_date_recur\Entity\SmartDateRule::validateRecurring() (line 1007 of /var/www/html/web/modules/contrib/smart_date/modules/smart_date_recur/src/Entity/SmartDateRule.php).
This can also throw a fatal TypeError on Drupal 11 due to the NULL value being passed:
TypeError: Drupal\Component\Utility\Html::escape(): Argument #1 ($text) must be of type string, null given, called in /var/www/html/web/core/lib/Drupal/Component/Render/FormattableMarkup.php on line 238 in Drupal\Component\Utility\Html::escape() (line 433 of /var/www/html/web/core/lib/Drupal/Component/Utility/Html.php).
#0 /var/www/html/web/core/lib/Drupal/Component/Render/FormattableMarkup.php(238): Drupal\Component\Utility\Html::escape()
#1 /var/www/html/web/core/lib/Drupal/Component/Render/FormattableMarkup.php(211): Drupal\Component\Render\FormattableMarkup::placeholderEscape()
#2 /var/www/html/web/core/lib/Drupal/Core/StringTranslation/TranslatableMarkup.php(192): Drupal\Component\Render\FormattableMarkup::placeholderFormat()
#3 /var/www/html/web/core/lib/Drupal/Core/StringTranslation/TranslatableMarkup.php(235): Drupal\Core\StringTranslation\TranslatableMarkup->render()
#4 /var/www/html/web/core/lib/Drupal/Core/Messenger/Messenger.php(54): Drupal\Core\StringTranslation\TranslatableMarkup->__toString()
#5 /var/www/html/web/core/lib/Drupal/Core/Form/FormErrorHandler.php(45): Drupal\Core\Messenger\Messenger->addMessage()
#6 /var/www/html/web/core/lib/Drupal/Core/Form/FormErrorHandler.php(23): Drupal\Core\Form\FormErrorHandler->displayErrorMessages()
#7 /var/www/html/web/core/lib/Drupal/Core/Form/FormValidator.php(205): Drupal\Core\Form\FormErrorHandler->handleFormErrors()
#8 /var/www/html/web/core/lib/Drupal/Core/Form/FormValidator.php(124): Drupal\Core\Form\FormValidator->finalizeValidation()
#9 /var/www/html/web/core/lib/Drupal/Core/Form/FormBuilder.php(616): Drupal\Core\Form\FormValidator->validateForm()
#10 /var/www/html/web/core/lib/Drupal/Core/Form/FormBuilder.php(343): Drupal\Core\Form\FormBuilder->processForm()
#11 /var/www/html/web/core/lib/Drupal/Core/Controller/FormController.php(73): Drupal\Core\Form\FormBuilder->buildForm()
#12 [internal function]: Drupal\Core\Controller\FormController->getContentResult()
Steps to reproduce
1. Using a Smart Date field that has "Allow recurring date values" enabled.
2. Switch the formatter to "Smart Date | Classic"
3. Create a recurring date with a start and end date of 04/11/2024 01:00 PM - 04/11/2024 02:00 PM.
4. Specify that it repeats weekly on Monday, and has an ends on date of 28/10/2024.
5. The error is triggered.
Proposed resolution
Add a fallback handler for when the time_wrapper element is unavailable.
Remaining tasks
Provide MR.
User interface changes
N/A
API changes
N/A
Data model changes
N/A
Issue fork smart_date-3618999
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #3
codebymikey commented