function locale_translate_file_create

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

Creates a file object and populates the timestamp property.

Parameters

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

Return value

object An object representing the file.

File

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

Code

function locale_translate_file_create($filepath) {
    $file = new stdClass();
    $file->filename = \Drupal::service('file_system')->basename($filepath);
    $file->uri = $filepath;
    $file->timestamp = filemtime($file->uri);
    return $file;
}

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