protected function TemporaryJsonapiFileFieldUploader::getUploadLocation in Drupal 8
Same name and namespace in other branches
- 9 core/modules/jsonapi/src/Controller/TemporaryJsonapiFileFieldUploader.php \Drupal\jsonapi\Controller\TemporaryJsonapiFileFieldUploader::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 TemporaryJsonapiFileFieldUploader::getUploadLocation()
- TemporaryJsonapiFileFieldUploader::handleFileUploadForField in core/
modules/ jsonapi/ src/ Controller/ TemporaryJsonapiFileFieldUploader.php - Creates and validates a file entity for a file field from a file stream.
File
- core/
modules/ jsonapi/ src/ Controller/ TemporaryJsonapiFileFieldUploader.php, line 435
Class
- TemporaryJsonapiFileFieldUploader
- Reads data from an upload stream and creates a corresponding file entity.
Namespace
Drupal\jsonapi\ControllerCode
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, [], [], new BubbleableMetadata()));
return $settings['uri_scheme'] . '://' . $destination;
}