You are here

protected static function ImceController::getUploadLocation in FileField Sources 8

Determines the URI for a file field.

Parameters

array $data: 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 ImceController::getUploadLocation()
ImceController::page in src/Controller/ImceController.php
Outputs the IMCE browser for FileField.

File

src/Controller/ImceController.php, line 87

Class

ImceController
Controller routines for imce routes.

Namespace

Drupal\filefield_sources\Controller

Code

protected static function getUploadLocation($settings, $data = []) {
  $destination = trim($settings['file_directory'], '/');

  // Replace tokens. To ensure that render context is empty, pass a bubbleable
  // metadata object to the replace method.
  $bubbleable_metadata = new BubbleableMetadata();
  $destination = \Drupal::token()
    ->replace($destination, $data, [], $bubbleable_metadata);
  return $settings['uri_scheme'] . '://' . $destination;
}