You are here

public function SalesforceMappableEntityTypes::getMappableEntityTypes in Salesforce Suite 5.0.x

Same name and namespace in other branches
  1. 8.4 modules/salesforce_mapping/src/SalesforceMappableEntityTypes.php \Drupal\salesforce_mapping\SalesforceMappableEntityTypes::getMappableEntityTypes()
  2. 8.3 modules/salesforce_mapping/src/SalesforceMappableEntityTypes.php \Drupal\salesforce_mapping\SalesforceMappableEntityTypes::getMappableEntityTypes()

Get an array of entity types that are mappable.

Return value

\Drupal\Core\Entity\EntityTypeInterface[] Objects which are exposed for mapping to Salesforce.

Overrides SalesforceMappableEntityTypesInterface::getMappableEntityTypes

File

modules/salesforce_mapping/src/SalesforceMappableEntityTypes.php, line 26

Class

SalesforceMappableEntityTypes
Mappable entity types constructor.

Namespace

Drupal\salesforce_mapping

Code

public function getMappableEntityTypes() {
  $entity_info = $this->entityTypeManager
    ->getDefinitions();
  $mappable = [];

  // We're only concerned with fieldable entities. This is a relatively
  // arbitrary restriction, but otherwise there would be an unweildy number
  // of entities. Also exclude MappedObjects themselves.
  foreach ($entity_info as $entity_type_id => $entity_type) {
    if ($this
      ->isMappable($entity_type)) {
      $mappable[$entity_type_id] = $entity_type;
    }
  }
  return $mappable;
}