You are here

protected function EmbedBase::decrementEmbeddedUsage in Entity Usage 8

Helper method to decrement the usage for embedded entities.

Parameters

\Drupal\Core\Entity\ContentEntityInterface $entity: The host entity object.

string $t_type: The type of the target entity.

string $uuid: The UUID of the target entity.

2 calls to EmbedBase::decrementEmbeddedUsage()
EmbedBase::trackOnEntityDeletion in src/Plugin/EntityUsage/Track/EmbedBase.php
Track usage updates on the deletion of entities.
EmbedBase::trackOnEntityUpdate in src/Plugin/EntityUsage/Track/EmbedBase.php
Track usage updates on the edition of entities.

File

src/Plugin/EntityUsage/Track/EmbedBase.php, line 243

Class

EmbedBase
Base class for plugins tracking usage in entities embedded in WYSIWYG fields.

Namespace

Drupal\entity_usage\Plugin\EntityUsage\Track

Code

protected function decrementEmbeddedUsage(ContentEntityInterface $entity, $t_type, $uuid) {
  $target_entity = $this->entityRepository
    ->loadEntityByUuid($t_type, $uuid);
  if ($target_entity) {
    $this->usageService
      ->delete($target_entity
      ->id(), $t_type, $entity
      ->id(), $entity
      ->getEntityTypeId());
  }
}