User deprecated function: Passing a string to Drupal\options\Plugin\Field\FieldType\ListItemBase::extractAllowedValues() is deprecated in drupal:10.2.0

Created on 11 April 2024, 12 months ago

Problem/Motivation

Code is using a deprecated function

Steps to reproduce

Use a smart date field in Drupal 10.2.0 and above

Proposed resolution

User deprecated function: Passing a string to Drupal\options\Plugin\Field\FieldType\ListItemBase::extractAllowedValues() is deprecated in drupal:10.2.0 and will cause an error from drupal:11.0.0. Use an array instead. See https://www.drupal.org/node/3376368 β†’ in Drupal\options\Plugin\Field\FieldType\ListItemBase::extractAllowedValues() (line 406 of core/modules/options/src/Plugin/Field/FieldType/ListItemBase.php).

Remaining tasks

Update code / config so that values are stored as an array

From SmartDateWidgetBase:
$increments = SmartDateListItemBase::parseValues($defaults['default_duration_increments']);

From SmartDateListItemBase:
public static function parseValues($values) {
// Use the ListItemBase parsing function, but don't allow generated keys.
$result = static::extractAllowedValues($values, 1);
return $result;
}

User interface changes

N/A

API changes

N/A

Data model changes

Must store default duration increments as an array instead of a string

πŸ› Bug report
Status

Closed: duplicate

Version

4.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States vegantriathlete Lakewood, CO

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

Comments & Activities

Production build 0.71.5 2024