You are here

function FileAddForm::getUploadDestinationUri in File Entity (fieldable files) 8.2

Determines the upload location for the file add upload form.

Parameters

array $params: An array of parameters from the media browser.

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

Return value

string A file directory URI with tokens replaced.

See also

token_replace()

1 call to FileAddForm::getUploadDestinationUri()
FileAddForm::stepUpload in src/Form/FileAddForm.php
Step 1 Generate form fields for the first step in the add file wizard.

File

src/Form/FileAddForm.php, line 173

Class

FileAddForm
Form controller for file type forms.

Namespace

Drupal\file_entity\Form

Code

function getUploadDestinationUri(array $params, array $data = array()) {
  $params += array(
    'uri_scheme' => $this
      ->config('system.file')
      ->get('default_scheme'),
    'file_directory' => '',
  );
  $destination = trim($params['file_directory'], '/');

  // Replace tokens.
  $destination = \Drupal::token()
    ->replace($destination, $data);
  return $params['uri_scheme'] . '://' . $destination;
}