protected function PopupMessageSettingsForm::recordFileUsage in Popup message 8
Records file usage of files referenced by formatted text fields.
Every referenced file that does not yet have the FILE_STATUS_PERMANENT state, will be given that state.
Parameters
array $uuids: An array of file entity UUIDs.
1 call to PopupMessageSettingsForm::recordFileUsage()
- PopupMessageSettingsForm::submitForm in src/
Form/ PopupMessageSettingsForm.php - Form submission handler.
File
- src/
Form/ PopupMessageSettingsForm.php, line 331
Class
- PopupMessageSettingsForm
- Class PopupMessageSettingsForm.
Namespace
Drupal\popup_message\FormCode
protected function recordFileUsage(array $uuids) {
try {
foreach ($uuids as $uuid) {
if ($file = $this->entityRepository
->loadEntityByUuid('file', $uuid)) {
if ($file->status !== FILE_STATUS_PERMANENT) {
$file->status = FILE_STATUS_PERMANENT;
$file
->save();
}
}
}
} catch (EntityStorageException $exception) {
$this
->logger('popup_message')
->warning($exception
->getMessage());
}
}