Handle for deprecated function “file_create_url() and “file_url_transform_relative()

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
- 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)

Reference Material: