You are here

function file_field_widget_uri in Drupal 7

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()

1 call to file_field_widget_uri()
file_field_widget_form in modules/file/file.field.inc
Implements hook_field_widget_form().

File

modules/file/file.field.inc, line 584
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;
}