You are here

public static function SupportedEntities::getEntityType in CiviCRM Entity 8.3

Gets the Drupal entity type for a CiviCRM object name.

Parameters

string $objectName: The CiviCRM object name.

Return value

string|false The Drupal entity type, or FALSE if not available.

3 calls to SupportedEntities::getEntityType()
CivicrmEntityViewsData::processViewsDataForCustomFields in src/CivicrmEntityViewsData.php
Add views integration for custom fields.
civicrm_entity_civicrm_post in ./civicrm_entity.module
Implements hook_civicrm_post().
civicrm_entity_civicrm_pre in ./civicrm_entity.module
Implements hook_civicrm_pre().

File

src/SupportedEntities.php, line 781

Class

SupportedEntities
Defines supported entities.

Namespace

Drupal\civicrm_entity

Code

public static function getEntityType($objectName) {
  switch ($objectName) {
    case 'Individual':
    case 'Household':
    case 'Organization':
      $entity_type = 'civicrm_contact';
      break;
    default:
      $entity_type = 'civicrm_' . static::getEntityNameFromCamel($objectName);
      break;
  }
  if (!array_key_exists($entity_type, static::getInfo())) {
    return FALSE;
  }
  return $entity_type;
}