Problem/Motivation
After installing the module and navigating to /admin/config/media/filepond, the following fatal error is thrown:
Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException:
You have requested a non-existent service "plugin.manager.media.source".
in Drupal\Component\DependencyInjection\Container->get()
(line 157 of /web/core/lib/Drupal/Component/DependencyInjection/Container.php).
The root cause is that drupal:media is not declared as a dependency in filepond.info.yml, so Drupal does not enforce the media module being enabled before FilePond is installed. The module however directly uses MediaType::loadMultiple() and implements hook_media_source_info_alter(), both of which require the media module and its services to be available.
Steps to reproduce
- Install Drupal 11.x with the FilePond module enabled but without explicitly enabling the media module.
- Navigate to
/admin/config/media/filepond.
- Observe the fatal
ServiceNotFoundException for plugin.manager.media.source.
Proposed resolution
Add drupal:media to the dependencies list in filepond.info.yml:
dependencies:
- drupal:file
- drupal:system
+ - drupal:media
Comments
Comment #3
dkmishra commentedComment #4
loze commentedThanks for reporting.
I didn't want to make media a hard requirement, though. The form element and image field widget work on plain file fields, so I'd rather not force media on sites that don't use it. Instead I made the media bits optional: the settings form only loads the media source service and shows the Media Library toggle when media is actually installed, and the media upload routes now register only when the media module is enabled.
So it works without media now, and behaves exactly as before with it. This is in 1.0.x. And should resolve the error you were seeing.