function EditorHooks::entityDelete

Same name and namespace in other branches
  1. 11.x core/modules/editor/src/Hook/EditorHooks.php \Drupal\editor\Hook\EditorHooks::entityDelete()

Implements hook_entity_delete().

Attributes

#[Hook('entity_delete')]

File

core/modules/editor/src/Hook/EditorHooks.php, line 245

Class

EditorHooks
Hook implementations for editor.

Namespace

Drupal\editor\Hook

Code

public function entityDelete(EntityInterface $entity) : void {
  // Only act on content entities.
  if (!$entity instanceof FieldableEntityInterface) {
    return;
  }
  $referenced_files_by_field = $this->getFileUuidsByField($entity);
  foreach ($referenced_files_by_field as $uuids) {
    $this->deleteFileUsage($uuids, $entity, 0);
  }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.