You are here

private function ReferenceMigrator::findTermReferenceFieldNames in Term reference change 8

Finds all names of term reference fields.

Parameters

string[] $limitToEntityTypes: The entity types to limit to. If left empty, all types are allowed.

Return value

string[] Array of entity reference field names for fields that reference taxonomy terms.

1 call to ReferenceMigrator::findTermReferenceFieldNames()
ReferenceMigrator::migrateReference in src/ReferenceMigrator.php
Updates the term reference on all entities from the source to the target.

File

src/ReferenceMigrator.php, line 72

Class

ReferenceMigrator
Migrates references from one taxonomy term to the other.

Namespace

Drupal\term_reference_change

Code

private function findTermReferenceFieldNames(array $limitToEntityTypes = []) {
  $fieldNames = [];
  foreach ($this->referenceFinder
    ->findTermReferenceFields() as $entityType => $bundle) {
    if (!empty($limitToEntityTypes) && !in_array($entityType, $limitToEntityTypes)) {
      continue;
    }
    foreach ($bundle as $fieldsInBundle) {
      $fieldNames = array_merge($fieldNames, $fieldsInBundle);
    }
  }
  return $fieldNames;
}