function locale_translate_file_create

Same name and namespace in other branches
  1. 10 core/modules/locale/locale.bulk.inc \locale_translate_file_create()
  2. 11.x core/modules/locale/locale.bulk.inc \locale_translate_file_create()
  3. 9 core/modules/locale/locale.bulk.inc \locale_translate_file_create()
  4. 8.9.x core/modules/locale/locale.bulk.inc \locale_translate_file_create()

Creates a file object and populates the timestamp and hash properties.

Parameters

string $filepath: The filepath of a file to import.

Return value

object An object representing the file.

Deprecated

in drupal:11.4.0 and is removed from drupal:13.0.0. Use LocaleFile instead.

See also

https://www.drupal.org/node/3577675

File

core/modules/locale/locale.bulk.inc, line 377

Code

function locale_translate_file_create($filepath) {
  @trigger_error(__FUNCTION__ . '() is deprecated in drupal:11.4.0 and is removed from drupal:13.0.0. Use LocaleFile instead. See https://www.drupal.org/node/3577675', E_USER_DEPRECATED);
  $hash = hash_file(LocaleSource::LOCAL_FILE_HASH_ALGO, $filepath);
  return new LocaleFile($filepath, basename($filepath), $hash, filemtime($filepath));
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.