1 file.entity.inc public File::__construct(array $values = array())

Constructor for file entities.

Overrides Entity::__construct

File

core/modules/file/file.entity.inc, line 92
Entity controller and class for files.

Class

File
Defines the file entity class.

Code

public function __construct(array $values = array()) {
  // Automatically detect filename if not set.
  if (!isset($values['filename']) && isset($values['uri'])) {
    $values['filename'] = backdrop_basename($values['uri']);
  }

  // Automatically detect filemime if not set.
  if (!isset($values['filemime']) && isset($values['uri'])) {
    $values['filemime'] = file_get_mimetype($values['uri']);
  }

  parent::__construct($values);
}