01
February
Functions file_create_url() was using to create url of images and files drupal 9 but now its not working in Drupal 10 so its deprecated now you can use code as follow to create url in Drupal 10
\Drupal::service('file_url_generator')->generateAbsoluteString($uri);
Used in Drupal 9 and before | Using Drupal 10 |
---|---|
file_create_url($uri) |
\Drupal::service('file_url_generator')->generateAbsoluteString($uri) |
file_url_transform_relative($file_url) |
\Drupal::service('file_url_generator')->transformRelative($file_url) |
file_url_transform_relative(file_create_url($uri) |
\Drupal::service('file_url_generator')->generateString($uri) |
Drupal\Core\Url::fromUri(file_create_url($uri)) |
\Drupal::service('file_url_generator')->generate($uri) |
© 2023.ZedAngle. All Rights Reserved.