function file_field_widget_uri

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

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;
}

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