Datepicker plugin gives Undefined array key "type"

Created on 14 June 2024, 6 months ago

We are using BEF 6.0.6 Datepicker plugin on a date filter with Drupal 9.5.11 and we got this warning in watchdog:

Warning : Undefined array key "type" dans Drupal\Core\Render\Element\Date::processDate() (.../Drupal/Core/Render/Element/Date.php ligne 71) 

Here is the method missing the 'type' key:

  public static function processDate(&$element, FormStateInterface $form_state, &$complete_form) {
    @trigger_error('Drupal\Core\Render\Element\Date::processDate() is deprecated in drupal:9.4.0 and is removed from drupal:10.0.0. There is no replacement. See https://www.drupal.org/node/3258267', E_USER_DEPRECATED);
    // Attach JS support for the date field, if we can determine which date
    // format should be used.
    if ($element['#attributes']['type'] == 'date' && !empty($element['#date_date_format'])) {
      $element['#attached']['library'][] = 'core/drupal.date';
      $element['#attributes']['data-drupal-date-format'] = [$element['#date_date_format']];
    }
    return $element;
  }

I don't think I have any core patch altering this method and no other module using it. While investigatiing I have found out that warning disapear when not using the datepicker from BEF. So I noticed that in the Datepickers.php file, just adding ['#attributes']['type'] = 'date'; to all elements solved my problem but I am not sure if this is the way to go or if it is really a BEF issue.
Anyone is having the same problem?

πŸ› Bug report
Status

Active

Version

6.0

Component

Code

Created by

πŸ‡§πŸ‡ͺBelgium davidiio

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

Comments & Activities

Production build 0.71.5 2024