From 26b7e6dc6c126c428339f2473d5a27f46407baf0 Mon Sep 17 00:00:00 2001 From: Dimitris Kritsotakis Date: Tue, 20 Feb 2024 19:27:14 +0200 Subject: [PATCH] EICNET-3010: cleanup --- lib/modules/eic_admin/eic_admin.module | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/modules/eic_admin/eic_admin.module b/lib/modules/eic_admin/eic_admin.module index 7f037516c..bef07aa3e 100644 --- a/lib/modules/eic_admin/eic_admin.module +++ b/lib/modules/eic_admin/eic_admin.module @@ -83,18 +83,18 @@ function eic_admin_form_alter(array &$form, FormStateInterface $form_state, $for */ function eic_admin_preprocess_input(&$variables) { - if ($variables['theme_hook_original'] === 'input__date' && $variables['element']['#attributes']['type'] === 'date' && in_array($variables['element']['#name'], Datepicker::FIELDS_OVERRIDE_DATEPICKER)) { - // class js-datepicker-custom or sth - $eu_short_date_pattern = DateFormat::load('eu_short_date')->getPattern(); + if ($variables['theme_hook_original'] === 'input__date' + && $variables['element']['#attributes']['type'] === 'date' + && in_array($variables['element']['#name'], Datepicker::FIELDS_OVERRIDE_DATEPICKER)) { + // Attach custom library and add class identifier to element. $variables['#attached']['library'][] = 'eic_admin/custom_datepicker'; - $variables['#attached']['drupalSettings']['elementId'][] = '#'.$variables['element']['#id']; $variables["attributes"]["class"][] = 'js-datepicker-custom'; - $variables['element']['#date_date_format']= $eu_short_date_pattern; + + // Set custom values for the library. $variables['attributes']['type'] = 'text'; $variables['attributes']['placeholder'] = 'DD/MM/YYYY'; $variables['attributes']['data-value'] = $variables['attributes']['value']; - $variables['eu_short_date'] = $eu_short_date_pattern; } }