public static function SupportedEntities::getEntityNameFromCamel in CiviCRM Entity 8.3
Convert possibly camel name to underscore separated entity name.
@TODO Why don't we just call the above function directly? Because the function is officially 'likely' to change as it is an internal api function and calling api functions directly is explicitly not supported.
Parameters
string $entity: Entity name in various formats e.g: Contribution => contribution, OptionValue => option_value, UFJoin => uf_join.
Return value
string $entity entity name in underscore separated format
See also
_civicrm_api_get_entity_name_from_camel()
1 call to SupportedEntities::getEntityNameFromCamel()
- SupportedEntities::getEntityType in src/
SupportedEntities.php - Gets the Drupal entity type for a CiviCRM object name.
File
- src/
SupportedEntities.php, line 819
Class
- SupportedEntities
- Defines supported entities.
Namespace
Drupal\civicrm_entityCode
public static function getEntityNameFromCamel($entity) {
if ($entity == strtolower($entity)) {
return $entity;
}
else {
$entity = ltrim(strtolower(str_replace('U_F', 'uf', preg_replace('/(?=[A-Z])/', '_$0', $entity))), '_');
}
return $entity;
}