By berdir on
Change record status:
Published (View all published change records)
Project:
Introduced in branch:
8.7.x
Introduced in version:
8.7.0
Issue links:
Description:
File::url() currently returns the URL to the physical file, this was done to be able to return the URL to the file as the self-URL in hal+json REST requests.
EntityInterface::url() has been deprecated in favor of EntityInterface::toUrl() and this behavior was never ported to the new method as it does not correspond to a route. It is now officially deprecated in favor of a new method that allows to access the created file URL.
The new method also converts to a relative URL by default, this behavior can be disabled:
$file->createFileUrl() == file_url_transform_relative(file_create_url($file->getFileUri()));
file_create_url($file->getFileUri()) == $file->createFileUrl(FALSE);
Impacts:
Module developers
Comments
file_create_url is also
file_create_url is also deprecated in: https://www.drupal.org/node/2940031