By ramprassad on
Change record status:
Published (View all published change records)
Project:
Introduced in branch:
11.2.x
Introduced in version:
11.2.0
Issue links:
Description:
As of Drupal 11.x, the function file_get_content_headers() has been deprecated and will be removed in Drupal 12.x. This previously enabled developers to get the content headers for the file, but after a review of its usage, it is being replaced by a more standardized call to a method getDownloadHeaders() in the File Entity
Before
$file = \Drupal::entityTypeManager()->getStorage('file')->load($fid);
file_get_content_headers($file);
After
$file = \Drupal::entityTypeManager()->getStorage('file')->load($fid);
$file->getDownloadHeaders();
Impacts:
Module developers