BaguetteboxFormatter::viewElements() uses the non existing file_url_generator service

Created on 31 October 2022, almost 2 years ago
Updated 26 January 2023, over 1 year ago

Problem/Motivation

When the module is installed on Drupal 8.9.20, it throws the following exception.

Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException: You have requested a non-existent service "file_url_generator". Did you mean one of these: "coffee.url_generator", "url_generator"? in Drupal\Component\DependencyInjection\Container->get() (line 153 of core/lib/Drupal/Component/DependencyInjection/Container.php).
Drupal::service('file_url_generator') (Line: 223)
Drupal\baguettebox\Plugin\Field\FieldFormatter\BaguetteboxFormatter->viewElements(Object, 'lv') (Line: 89)
Drupal\Core\Field\FormatterBase->view(Object, 'lv') (Line: 76)

The code needs to first check that service exists, before it uses it. If it doesn't exist, it needs to use file_url_transform_relative().

🐛 Bug report
Status

Closed: won't fix

Version

1.0

Component

Code

Created by

🇱🇻Latvia Nor4a

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • 🇧🇷Brazil elber Brazil

    Hi thank you for your work, but now the issue is not necessary Baquettebox module has different versions to Drupal8, Drupal9 and Drupal. 10

Production build 0.71.5 2024