From fb838fbfc83e2695fc9576eec67c3b25ed367caf Mon Sep 17 00:00:00 2001 From: Joao Ventura <19380-jcnventura@users.noreply.drupalcode.org> Date: Sat, 1 Jun 2024 02:17:23 +0200 Subject: [PATCH] Issue #3117460 by nicola85, billdaff, jcnventura: Does not work with #AJAX --- src/Element/SingleDateTime.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/Element/SingleDateTime.php b/src/Element/SingleDateTime.php index 0263869..7ada718 100644 --- a/src/Element/SingleDateTime.php +++ b/src/Element/SingleDateTime.php @@ -24,7 +24,10 @@ class SingleDateTime extends FormElement { '#input' => TRUE, '#multiple' => FALSE, '#maxlength' => 512, - '#process' => [[$class, 'processSingleDateTime']], + '#process' => [ + [$class, 'processSingleDateTime'], + [$class, 'processAjaxForm'], + ], '#pre_render' => [[$class, 'preRenderSingleDateTime']], '#size' => 25, '#theme_wrappers' => ['form_element'], @@ -140,6 +143,10 @@ class SingleDateTime extends FormElement { $settings['data-single-date-time'] = $range_date_type; } + if (isset($element['#ajax']) && !isset($element['#ajax']['event'])) { + $element['#ajax']['event'] = 'change'; + } + // Append our attributes to element. $element['#attributes'] += $settings; -- GitLab