You are here

protected function EmbedBase::incrementEmbeddedUsage in Entity Usage 8

Helper method to increment 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::incrementEmbeddedUsage()
EmbedBase::trackOnEntityCreation in src/Plugin/EntityUsage/Track/EmbedBase.php
Track usage updates on the creation 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 226

Class

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

Namespace

Drupal\entity_usage\Plugin\EntityUsage\Track

Code

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