You are here

protected function FieldUtilsTrait::getDestinationFields in Scheduled Updates 8

Return all fields that can be used as destinations fields.

Parameters

$entity_type_id:

\Drupal\field\Entity\FieldConfig $source_field:

Return value

\Drupal\Core\Field\FieldStorageDefinitionInterface[]

3 calls to FieldUtilsTrait::getDestinationFields()
FieldClonerForm::createFieldsElements in src/Form/FieldClonerForm.php
Create field elements for all field on the entity type to update.
FieldUtilsTrait::getDestinationFieldsOptions in src/FieldUtilsTrait.php
FieldUtilsTrait::getEntityDestinationOptions in src/FieldUtilsTrait.php

File

src/FieldUtilsTrait.php, line 37
Contains \Drupal\scheduled_updates\FieldUtilsTrait.

Class

FieldUtilsTrait

Namespace

Drupal\scheduled_updates

Code

protected function getDestinationFields($entity_type_id, FieldConfig $source_field = NULL) {
  $destination_fields = [];
  $fields = $this
    ->FieldManager()
    ->getFieldStorageDefinitions($entity_type_id);
  foreach ($fields as $field_id => $field) {
    if ($this
      ->isDestinationFieldCompatible($field, $source_field)) {
      $destination_fields[$field_id] = $field;
    }
  }
  return $destination_fields;
}