1 file.field.inc file_field_widget_uri($field, $instance, $data = array())

Determines the URI for a file field instance.

Parameters

$field: A field array.

$instance: A field instance array.

$data: An array of token objects to pass to token_replace().

Return value

A file directory URI with tokens replaced.:

See also

token_replace()

File

core/modules/file/file.field.inc, line 763
Field module functionality for the File module.

Code

function file_field_widget_uri($field, $instance, $data = array()) {
  $destination = trim($instance['settings']['file_directory'], '/');

  // Replace tokens.
  $destination = token_replace($destination, $data);

  return $field['settings']['uri_scheme'] . '://' . $destination;
}