You are here

public function EntityUpdateManager::trackUpdateOnEdition in Entity Usage 8

Same name and namespace in other branches
  1. 8.2 src/EntityUpdateManager.php \Drupal\entity_usage\EntityUpdateManager::trackUpdateOnEdition()
  2. 8.3 src/EntityUpdateManager.php \Drupal\entity_usage\EntityUpdateManager::trackUpdateOnEdition()

Track updates on edit / update of potential host entities.

Parameters

\Drupal\Core\Entity\ContentEntityInterface $entity: The entity we are dealing with.

File

src/EntityUpdateManager.php, line 97

Class

EntityUpdateManager
Class EntityUpdateManager.

Namespace

Drupal\entity_usage

Code

public function trackUpdateOnEdition(ContentEntityInterface $entity) {

  // Only act on content entities.
  if (!$entity instanceof ContentEntityInterface) {
    return;
  }

  // Call all plugins that want to track entity usages.
  foreach ($this->trackManager
    ->getDefinitions() as $plugin_id => $plugin_definition) {

    /** @var EntityUsageTrackInterface $instance */
    $instance = $this->trackManager
      ->createInstance($plugin_id);
    $instance
      ->trackOnEntityUpdate($entity);
  }
}