function datetime_extras_field_widget_info_alter in Datetime Extras 8
Implements hook_field_widget_info_alter().
Remove the daterange_duration widget unless a sufficiently modern version of duration_field module is enabled.
File
- ./
datetime_extras.module, line 29 - Hooks for the datetime_extras module.
Code
function datetime_extras_field_widget_info_alter(array &$info) {
if (!method_exists('\\Drupal\\duration_field\\Service\\DurationService', 'convertDateArrayToDateInterval')) {
// If we don't have 8.x-2.0-rc2 or later, hide the widget.
unset($info['daterange_duration']);
}
}