You are here

public function PrivateFileSchemeHandler::addAttributes in Acquia Content Hub 8.2

Throws

\Exception

Overrides FileSchemeHandlerInterface::addAttributes

File

src/Plugin/FileSchemeHandler/PrivateFileSchemeHandler.php, line 80

Class

PrivateFileSchemeHandler
File scheme handler for private files.

Namespace

Drupal\acquia_contenthub\Plugin\FileSchemeHandler

Code

public function addAttributes(CDFObject $object, FileInterface $file) {
  $uri = $file
    ->getFileUri();
  $webhook_url = Url::fromUri('internal:/acquia-contenthub/webhook', [
    'absolute' => TRUE,
  ])
    ->toString();
  $object
    ->addAttribute('file_scheme', CDFAttribute::TYPE_STRING, 'private');
  $object
    ->addAttribute('file_location', CDFAttribute::TYPE_STRING, $webhook_url);
  $object
    ->addAttribute('file_uri', CDFAttribute::TYPE_STRING, $uri);
}