You are here

function entity_metadata_system_get_file_properties in Entity API 7

Callback for getting file properties.

See also

entity_metadata_system_entity_info_alter()

1 string reference to 'entity_metadata_system_get_file_properties'
entity_metadata_system_entity_property_info in modules/system.info.inc
Implements hook_entity_property_info() on top of system module.

File

modules/callbacks.inc, line 279
Provides various callbacks for the whole core module integration.

Code

function entity_metadata_system_get_file_properties($file, array $options, $name) {
  switch ($name) {
    case 'name':
      return $file->filename;
    case 'mime':
      return $file->filemime;
    case 'size':
      return $file->filesize;
    case 'url':
      return url(file_create_url($file->uri), $options);
    case 'owner':
      return $file->uid;
  }
}