You are here

public static function SupportTicket::preDelete in Support Ticketing System 8

Acts on entities before they are deleted and before hooks are invoked.

Used before the entities are deleted and before invoking the delete hook.

Parameters

\Drupal\Core\Entity\EntityStorageInterface $storage: The entity storage object.

\Drupal\Core\Entity\EntityInterface[] $entities: An array of entities.

Overrides EntityBase::preDelete

File

modules/support_ticket/src/Entity/SupportTicket.php, line 124
Contains \Drupal\support_ticket\Entity\SupportTicket.

Class

SupportTicket
Defines the support ticket entity class.

Namespace

Drupal\support_ticket\Entity

Code

public static function preDelete(EntityStorageInterface $storage, array $entities) {
  parent::preDelete($storage, $entities);

  // Ensure that all support_tickets deleted are removed from the search index.
  if (\Drupal::moduleHandler()
    ->moduleExists('search')) {
    foreach ($entities as $entity) {
      search_index_clear('support_ticket_search', $entity->stid->value);
    }
  }
}