Skip to content
Snippets Groups Projects

Issue #3272756: Entity Delete Operations too open

1 file
+ 8
2
Compare changes
  • Side-by-side
  • Inline
+ 8
2
@@ -135,8 +135,14 @@ function usage_data_file_download($uri) {
* Implements hook_entity_predelete().
*/
function usage_data_entity_predelete(EntityInterface $entity) {
// Clean up usage_data tables when entity is deleted.
return \Drupal::service('usage_data.storage.database')->deleteUsageData($entity->id(), $entity->getEntityTypeId());
$config = \Drupal::config('usage_data.settings')
->get();
// Checking if entity could have usage data to delete.
if (isset($config[$entity->getEntityTypeId()]) && isset($config[$entity->getEntityTypeId() . '_views'])) {
// Clean up usage_data tables when entity is deleted.
return \Drupal::service('usage_data.storage.database')->deleteUsageData($entity->id(), $entity->getEntityTypeId());
}
}
/**
Loading