protected function OutputHandler::rememberFileContext in FillPDF 8.4
Same name and namespace in other branches
- 5.0.x src/OutputHandler.php \Drupal\fillpdf\OutputHandler::rememberFileContext()
Saves the file context.
Parameters
\Drupal\file\FileInterface $fillpdf_file: File object containing the generated PDF file.
array $context: An associative array representing the context of the generated file. This array should match the format returned by FillPdfLinkManipulator::parseLink().
See also
\Drupal\fillpdf\FillPdfLinkManipulatorInterface::parseLink()
FileFieldItemList::postSave()
1 call to OutputHandler::rememberFileContext()
- OutputHandler::savePdfToFile in src/
OutputHandler.php - Saves merged PDF data to the filesystem.
File
- src/
OutputHandler.php, line 141
Class
- OutputHandler
- Class OutputHandler.
Namespace
Drupal\fillpdfCode
protected function rememberFileContext(FileInterface $fillpdf_file, array $context) {
$fillpdf_link = $this->linkManipulator
->generateLink($context);
$fillpdf_file_context = FillPdfFileContext::create([
'file' => $fillpdf_file,
'context' => $fillpdf_link
->toUriString(),
]);
// The file field will automatically add file usage information upon save.
$fillpdf_file_context
->save();
}