- Issue created by @omkar-pd
- Status changed to Needs review
9 months ago 9:39am 28 February 2024
I'm using Drupal 9.2.21.
After saving the node, the error is thrown.
You have requested a non-existent service "file_url_generator"
The file_url_generator
service is added Drupal 9.3 version. So the older versions will get this error.
Either make minisite 2.0.0 compatible with only Drupal 9.3 and newer versions.
OR
Use something like to support older versions of Drupal 9.
if (\Drupal::hasService('file_url_generator')) {
$generator = \Drupal::service('file_url_generator');
$file_url = $generator->transformRelative($generator->generateAbsoluteString($file->getFileUri()));
} else {
$file_url = file_create_url($file->getFileUri());
}
Reference:- https://www.drupal.org/node/2940031 →
Needs review
2.0
Code