function file_field_widget_uri

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

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

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/modules!file!file.field.inc/function/file_field_widget_uri/7.x