You are here

public function ContentEntityTrackingManager::entityInsert in Search API 8

Implements hook_entity_insert().

Adds entries for all languages of the new entity to the tracking table for each index that tracks entities of this type.

By setting the $entity->search_api_skip_tracking property to a true-like value before this hook is invoked, you can prevent this behavior and make the Search API ignore this new entity.

Parameters

\Drupal\Core\Entity\EntityInterface $entity: The new entity.

See also

search_api_entity_insert()

File

src/Plugin/search_api/datasource/ContentEntityTrackingManager.php, line 78

Class

ContentEntityTrackingManager
Provides hook implementations on behalf of the Content Entity datasource.

Namespace

Drupal\search_api\Plugin\search_api\datasource

Code

public function entityInsert(EntityInterface $entity) {
  if ($entity instanceof ContentEntityInterface) {
    $this
      ->trackEntityChange($entity, TRUE);
  }
}