_editor_delete_file_usage(array $uuids, EntityInterface $entity, $count)
Deletes file usage of files referenced by formatted text fields.
Parameters
array $uuids: An array of file entity UUIDs.
EntityInterface $entity: An entity whose fields to inspect for file references.
$count: The number of references to delete. Should be 1 when deleting a single revision and 0 when deleting an entity entirely.
See also
\Drupal\file\FileUsage\FileUsageInterface::delete()
File
- core/modules/editor/editor.module, line 462
- Adds bindings for client-side "text editors" to text formats.
Code
function _editor_delete_file_usage(array $uuids, EntityInterface $entity, $count) { foreach ($uuids as $uuid) { if ($file = \Drupal::entityManager()->loadEntityByUuid('file', $uuid)) { \Drupal::service('file.usage')->delete($file, 'editor', $entity->getEntityTypeId(), $entity->id(), $count); } } }
Please login to continue.