SalesforceMappableEntityTypes.php in Salesforce Suite 8.4
File
modules/salesforce_mapping/src/SalesforceMappableEntityTypes.php
View source
<?php
namespace Drupal\salesforce_mapping;
use Drupal\Core\Entity\EntityTypeManagerInterface;
use Drupal\Core\Entity\EntityTypeInterface;
class SalesforceMappableEntityTypes implements SalesforceMappableEntityTypesInterface {
public function __construct(EntityTypeManagerInterface $entity_manager) {
$this->entityTypeManager = $entity_manager;
}
public function getMappableEntityTypes() {
$entity_info = $this->entityTypeManager
->getDefinitions();
$mappable = [];
foreach ($entity_info as $entity_type_id => $entity_type) {
if ($this
->isMappable($entity_type)) {
$mappable[$entity_type_id] = $entity_type;
}
}
return $mappable;
}
public function isMappable(EntityTypeInterface $entity_type) {
if (in_array('Drupal\\Core\\Entity\\ContentEntityTypeInterface', class_implements($entity_type)) && $entity_type
->id() != 'salesforce_mapped_object') {
return TRUE;
}
return FALSE;
}
}