As of Drupal version 9.3, the property $fileUrlGenerator is accessible directly from the Image Link Formatter's parent class ImageFormatter, see corresponding ticket and commit (added more than a year ago):
- Issue patch: #2669074-254: Convert file_create_url() & file_url_transform_relative() to service, deprecate it
- Commit: https://git.drupalcode.org/project/drupal/-/commit/3e4b17a7c9a9260212021...
- See code files:
- Drupal 9.2.x: https://git.drupalcode.org/project/drupal/-/blob/9.2.x/core/modules/imag... (not in the class)
- Drupal 9.3.x: https://git.drupalcode.org/project/drupal/-/blob/9.3.x/core/modules/imag...
Therefore, going forward, since Drupal core 9.2 is not supported since June 15 2022, a year after verison 9.2.0 was released and more than a year ago, we should probably keep the maintenance of module's 2.1.x branch (D9/10 compatible) focused on the versions currently supported for Drupal core (as of this post (9.3/9.4/9.5).
See for example the Metatag module dropping support for D9.2 at:
#3252150-56: Drupal 10 compatibility for Metatag
For the Image Link Formatter module, dropping support for D9.2 would probably require the following changes:
- Updating module's info file's
core_version_requirementand maybe composer.json dependencies as well. - Removing property
$fileUrlGeneratorfrom classImageLinkFormatter. - Removin any mention to versions lower than 9.3 in Functional test cases (
floatval(\Drupal::VERSION) < 9.1), since they should no longer run on systems prior to D9.3.
Feel free to let us know if you have any questions or comments on any of the suggested changes or the ticket in general, we would be glad to have your feedback.
Comments
Comment #3
dydave commentedQuick follow-up on this issue:
core_version_requirementto support 9.3 and above ('^9.3 || ^10') and added version constraint"drupal/core:^9.3 || ^10"to composer.json to specify version dependency (similar to what was done for the Metatag module, see link in issue summary).$fileUrlGeneratorfrom classImageLinkFormatterand updated accordingly container methods.ImageLinkFormatterTest.The changes were committed to branch 2.1.x at:
https://git.drupalcode.org/project/image_link_formatter/-/commit/e80e702...
Feel free to let us know if you have any questions, comments, concerns or feedback on any of the recent code changes or the ticket in general, we would certainly be happy to help.
Thanks in advance!