Drupal 12 compatibility / deprecations fixes for geofield

Generated with the help of an LLM

Problem/Motivation

Update/extend the Drupal Geofield module compatibility / deprecations fixes with Drupal 12, still guaranteeing backwood compatibility with Drupal 10.3 and Drupal 11.

Data model changes

Move geofield.module helper functions into GeofieldService

Drupal 11.5 deprecates code in .module files, and flags any function there that has no #[LegacyHook] attribute. geofield.module now holds only #[LegacyHook] wrappers (plus its constants), like geofield_map.module.

  • Add the geofield.service service (Drupal\geofield\Services
    GeofieldService) with radiusOptions() and haversine(), which replace geofield_radius_options() and geofield_haversine(). The procedural functions are removed.

  • Move hook_field_type_category_info_alter() into GeofieldHooks::fieldTypeCategoryInfoAlter(), with a #[LegacyHook] wrapper kept for Drupal 10.3 and 11.0.

  • Inject the service into GeofieldProximityFilter and GeofieldProximityArgument through an optional constructor argument that falls back to the container, so subclasses keep working.

  • Add the new \Drupal calls to the PHPStan baseline.

  • .gitlab-ci.yml updated to run the Drupal 12 (next major) CI jobs automatically

Co-Authored-By: Claude Opus 5.5 noreply@anthropic.com

Closes #3644014

Merge request reports

Loading
Loading