The GPX field widget is not compatible with Drupal 11.
Uploading a GPX file immediately fails with:
Drupal\Component\Plugin\Exception\PluginNotFoundException:
The "file_validate_extensions" plugin does not exist.
Backtrace shows the failure occurs during file upload validation:
Drupal\Core\Validation\ConstraintManager->create()
Drupal\file\Validation\FileValidator->validate()
Drupal\file\Upload\FileUploadHandler->handleFileUpload()
Drupal\file\Element\ManagedFile::valueCallback()
Cause
The widget still uses the legacy upload validator:
'#upload_validators' => [
'file_validate_extensions' => ['gpx xml'],
],
This validator was removed in Drupal 11 and replaced by the new validation constraint system.
The code is located in:
modules/contrib/geolocation/modules/geolocation_gpx/src/Plugin/Field/FieldWidget/GeolocationGpxFileWidget.php
Additional compatibility issues
After patching the upload validator locally to continue testing, additional Drupal 11 / PHP 8.5 compatibility problems were encountered:
GPX metadata author is stored directly:
'author' => $data->metadata->author ?? '',
$data->metadata->author is a phpGPX\Models\Person object, resulting in:
Object of class phpGPX\Models\Person could not be converted to string
Other metadata fields (for example copyright) also appear to be objects rather than strings.
Additional render-array errors were encountered after working around the upload validator, suggesting further Drupal 11 compatibility issues in the GPX widget.
Steps to reproduce
Install Drupal 11.4.x
Install Geolocation 4.x-dev
Enable the Geolocation GPX submodule.
Create or edit an entity using the GPX field widget.
Upload a .gpx file.
Expected result
The GPX file uploads successfully and is parsed.
Actual result
The upload fails immediately with:
PluginNotFoundException:
The "file_validate_extensions" plugin does not exist.
Issue fork geolocation-3614597
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #4
velmir_taky commentedComment #6
christianadamski commentedThanks!