You are here

public function LinkExtractorBatch::getEntityTypesToProcess in Link checker 8

Gets list of entity types that selected for extraction.

Return value

array List of entity types with bundles.

2 calls to LinkExtractorBatch::getEntityTypesToProcess()
LinkExtractorBatch::getTotalEntitiesToProcess in src/LinkExtractorBatch.php
Gets total number of entities to process.
LinkExtractorBatch::processEntities in src/LinkExtractorBatch.php
Process part of entities.

File

src/LinkExtractorBatch.php, line 58

Class

LinkExtractorBatch
Helper service to handle extraction index.

Namespace

Drupal\linkchecker

Code

public function getEntityTypesToProcess() {
  $fieldConfigs = $this->entityTypeManager
    ->getStorage('field_config')
    ->loadMultiple(NULL);
  $entityTypes = [];

  /** @var \Drupal\Core\Field\FieldConfigInterface $config */
  foreach ($fieldConfigs as $config) {
    $scan = $config
      ->getThirdPartySetting('linkchecker', 'scan', FALSE);
    if ($scan) {
      $entityTypeId = $config
        ->getTargetEntityTypeId();
      $bundle = $config
        ->getTargetBundle();
      if (!isset($entityTypes[$entityTypeId . '-' . $bundle])) {
        $entityType = $this->entityTypeManager
          ->getDefinition($entityTypeId);
        $entityTypes[$entityTypeId . '-' . $bundle] = [
          'entity_type' => $entityType,
          'bundle' => $bundle,
        ];
      }
    }
  }
  return $entityTypes;
}