protected function MediaPdfThumbnailImageManager::createThumbnailFileEntity in Media PDF Thumbnail 8.4
Same name and namespace in other branches
- 8 src/Manager/MediaPdfThumbnailImageManager.php \Drupal\media_pdf_thumbnail\Manager\MediaPdfThumbnailImageManager::createThumbnailFileEntity()
- 8.2 src/Manager/MediaPdfThumbnailImageManager.php \Drupal\media_pdf_thumbnail\Manager\MediaPdfThumbnailImageManager::createThumbnailFileEntity()
- 8.3 src/Manager/MediaPdfThumbnailImageManager.php \Drupal\media_pdf_thumbnail\Manager\MediaPdfThumbnailImageManager::createThumbnailFileEntity()
Parameters
$fileUri:
Return value
array|void|null
Throws
\Drupal\Component\Plugin\Exception\InvalidPluginDefinitionException
\Drupal\Component\Plugin\Exception\PluginNotFoundException
\Drupal\Core\Entity\EntityStorageException
1 call to MediaPdfThumbnailImageManager::createThumbnailFileEntity()
File
- src/
Manager/ MediaPdfThumbnailImageManager.php, line 146
Class
- MediaPdfThumbnailImageManager
- Class MediaPdfThumbnailImageManager.
Namespace
Drupal\media_pdf_thumbnail\ManagerCode
protected function createThumbnailFileEntity($fileUri) {
if (empty($fileUri)) {
return;
}
$infos = pathinfo($fileUri);
$fileEntity = $this->entityTypeManager
->getStorage('file')
->create([
'uri' => $fileUri,
'status' => FILE_STATUS_PERMANENT,
]);
$fileEntity
->save();
return $fileEntity ? [
'fid' => $fileEntity
->id(),
'filename' => $infos['filename'],
] : NULL;
}