Skip to content

Commit

Permalink
EICNET-3010: cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
dimitriskr committed Feb 20, 2024
1 parent e3f0598 commit 26b7e6d
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions lib/modules/eic_admin/eic_admin.module
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

}

0 comments on commit 26b7e6d

Please sign in to comment.