You are here

function _commerce_file_get_entity_type in Commerce File 7

Return entity type from an entity

1 call to _commerce_file_get_entity_type()
_commerce_file_field_aggregate_files in includes/commerce_file.field.inc
Return all commerce_file fields for a given entity, indexed by fid

File

./commerce_file.module, line 1281
Provides integration of file licenses with Commerce

Code

function _commerce_file_get_entity_type($entity) {

  // entity implements an entity class
  if (method_exists($entity, 'entityType')) {
    return $entity
      ->entityType();
  }

  // entity is an entity wrapper
  if (method_exists($entity, 'type')) {
    return $entity
      ->type();
  }
  return NULL;
}