You are here

function linkchecker_entity_update in Link checker 8

Implements hook_entity_update().

File

./linkchecker.module, line 167
This module periodically check links in given node types, blocks etc.

Code

function linkchecker_entity_update(EntityInterface $entity) {
  if ($entity instanceof LinkCheckerLinkInterface) {
    return;
  }
  if ($entity instanceof FieldableEntityInterface) {

    /** @var \Drupal\linkchecker\LinkExtractorService $extractor */
    $extractor = \Drupal::service('linkchecker.extractor');
    $links = $extractor
      ->extractFromEntity($entity);
    $extractor
      ->saveLinkMultiple($links);
    $extractor
      ->updateEntityExtractIndex($entity);
    \Drupal::service('linkchecker.clean_up')
      ->cleanUpForEntity($entity);
  }
}