function FileUploadResource::getUploadLocation
Same name in other branches
- 9 core/modules/file/src/Plugin/rest/resource/FileUploadResource.php \Drupal\file\Plugin\rest\resource\FileUploadResource::getUploadLocation()
- 10 core/modules/file/src/Plugin/rest/resource/FileUploadResource.php \Drupal\file\Plugin\rest\resource\FileUploadResource::getUploadLocation()
Determines the URI for a file field.
Parameters
array $settings: The array of field settings.
Return value
string An un-sanitized file directory URI with tokens replaced. The result of the token replacement is then converted to plain text and returned.
1 call to FileUploadResource::getUploadLocation()
- FileUploadResource::post in core/
modules/ file/ src/ Plugin/ rest/ resource/ FileUploadResource.php - Creates a file from an endpoint.
File
-
core/
modules/ file/ src/ Plugin/ rest/ resource/ FileUploadResource.php, line 537
Class
- FileUploadResource
- File upload resource.
Namespace
Drupal\file\Plugin\rest\resourceCode
protected function getUploadLocation(array $settings) {
$destination = trim($settings['file_directory'], '/');
// Replace tokens. As the tokens might contain HTML we convert it to plain
// text.
$destination = PlainTextOutput::renderFromHtml($this->token
->replace($destination, []));
return $settings['uri_scheme'] . '://' . $destination;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.