/**
  * Implements Drupal\file\FileUsage\FileUsageInterface::add().
  */
 public function add(FileInterface $file, $module, $type, $id, $count = 1)
 {
     // Make sure that a used file is permanent.
     if (!$file->isPermanent()) {
         $file->setPermanent();
         $file->save();
     }
 }
Пример #2
0
 /**
  * @param \Drupal\file\FileInterface $file
  */
 protected function saveFileUpload(FileInterface $file) {
   // Save the file to get an fid, and then create a FillPdfForm record
   // based off that.
   $file->setPermanent();
   // Save the file so we can get an fid
   $file->save();
 }