Missing dependency on datetime module

Created on 21 August 2025, 19 days ago

Problem/Motivation

\Drupal\search_api\Plugin\views\field\SearchApiDate depends on \Drupal\datetime\Plugin\Field\FieldType\DateTimeItemInterface from the datetime module, so when you visit a Views based page that leverages the search_api_date Views field plugin on a site where the datetime module is not yet installed, you get a WSOD with

Error: Class "Drupal\datetime\Plugin\Field\FieldType\DateTimeItemInterface" not found in Drupal\search_api\Plugin\views\field\SearchApiDate->render_item() (line 43 of modules/contrib/search_api/src/Plugin/views/field/SearchApiDate.php).

Steps to reproduce

This happened to when a tried the search_api_solr_log module and visited /admin/reports/search-api-solr-log.

Proposed resolution

I am aware of the complexity of the answer here, since Views field plugins are only loaded when Views module is enabled therefore the datetime module is only a missing dependency when the Views module is enabled.

This probably means adding a transitional dependency on datetime might not be the right approach, maybe Search API could auto-enable datetime when Views module is installed - or at least it could have a runtime requirement check with error severity when Views module is enabled without the datetime module, or else...?

Remaining tasks

🐛 Bug report
Status

Active

Version

1.0

Component

Views integration

Created by

🇭🇺Hungary mxr576 Hungary

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

Comments & Activities

Production build 0.71.5 2024