Issue #3598572: Drupal 12 compatibility

This comment was drafted by an LLM before it was reviewed by me.

One merge request for Drupal 12 compatibility. It replaces !47 (closed) and !48 (closed); the !48 (closed) commits by Nick Hope are merged in unchanged.

Fixes for errors on Drupal 12:

  • GeoConstraintValidator::validate() declares mixed $value and a void return, matching Symfony Validator 8. The old declaration is a fatal error.
  • GeofieldBackendManager and GeofieldProximitySourceManager use new GeofieldBackend and GeofieldProximitySource attribute classes. Drupal 12 throws an exception for annotation-only plugin managers. The annotation classes stay, so annotated plugins in other modules are still found.
  • hook_theme() and hook_field_views_data() are OOP hooks with LegacyHook fallbacks (from !48 (closed)). Drupal 12 no longer loads geofield.views.inc, so the Views integration would otherwise disappear.

Deprecations and tests:

  • The field type, widgets, formatters, GeoType constraint, form elements, migrate process plugins and Views handlers use attributes instead of annotations, so the Drupal 12 PHPUnit job no longer fails on deprecation notices.
  • Tests carry PHPUnit attributes, including #[RunTestsInSeparateProcesses], which Drupal 12 requires (from !48 (closed)).
  • Lint and spelling fixes, and .gitlab-ci.yml uses the 1.x-latest templates (from !48 (closed)).

Left as annotations: the Feeds target, Diff field builder and migrate_drupal field plugin, whose plugin managers belong to contrib modules.

Nothing here needs more than Drupal 10.3: every attribute used exists there.

Testing: geofield's tests pass on Drupal 11.5 apart from the GeoJSON enhancer tests, which need jsonapi_extras, and a temporary kernel test confirmed that every converted plugin is discovered with its old definition. Locally under PHP 8.4, every class in src/ loads against Symfony 8 and Drupal 12.0.0-beta2, and the two geofield plugin managers find all six plugins; the next-major job in this pipeline is the full check on Geofield.

Edited by Tyler Brown Cifu Shuster

Merge request reports

Loading
Loading