You are here

protected static function VideoUploadWidget::doGetUploadLocation in Video 8

Same name and namespace in other branches
  1. 8.2 src/Plugin/Field/FieldWidget/VideoUploadWidget.php \Drupal\video\Plugin\Field\FieldWidget\VideoUploadWidget::doGetUploadLocation()

Determines the URI for a video field.

Parameters

array $settings: The array of field settings.

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

Return value

string An unsanitized file directory URI with tokens replaced. The result of the token replacement is then converted to plain text and returned.

1 call to VideoUploadWidget::doGetUploadLocation()
VideoUploadWidget::getUploadLocation in src/Plugin/Field/FieldWidget/VideoUploadWidget.php
Determines the URI for a video field.

File

src/Plugin/Field/FieldWidget/VideoUploadWidget.php, line 233

Class

VideoUploadWidget
Plugin implementation of the 'video_upload' widget.

Namespace

Drupal\video\Plugin\Field\FieldWidget

Code

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

  // Replace tokens. As the tokens might contain HTML we convert it to plain
  // text.
  $destination = PlainTextOutput::renderFromHtml(\Drupal::token()
    ->replace($destination, $data));
  return $settings['uri_scheme'] . '://' . $destination;
}