You are here

private function PropertyEntityReference::getUserReferenceFields in User Merge 2.x

Get user reference fields.

Return value

\Drupal\Core\Field\FieldStorageDefinitionInterface[] Referenced fields.

Throws

\Drupal\Component\Plugin\Exception\InvalidPluginDefinitionException

\Drupal\Component\Plugin\Exception\PluginNotFoundException

1 call to PropertyEntityReference::getUserReferenceFields()
PropertyEntityReference::process in src/Plugin/UserMerge/Property/PropertyEntityReference.php
Process merge on selected property.

File

src/Plugin/UserMerge/Property/PropertyEntityReference.php, line 117

Class

PropertyEntityReference
Class PropertyEntityReference.

Namespace

Drupal\usermerge\Plugin\UserMerge\Property

Code

private function getUserReferenceFields() {
  $references = [];

  /** @var \Drupal\Core\Field\FieldStorageDefinitionInterface[] $fields */
  $fields = $this->entityTypeManager
    ->getStorage('field_storage_config')
    ->loadMultiple();
  foreach ($fields as $field) {
    if ($field
      ->getType() != 'entity_reference') {
      continue;
    }
    if ($field
      ->getSetting('target_type') != 'user') {
      continue;
    }
    $references[] = $field;
  }
  return $references;
}