Returns the defined bundles for the given entity type.
string $entity_type: The entity type whose bundles should be returned.
array An array containing the bundle names or the entity type name itself if no bundle is defined.
function entity_get_bundles($entity_type) {
$entity_info = entity_get_info($entity_type);
return isset($entity_info['bundles']) ? array_keys($entity_info['bundles']) : array(
$entity_type,
);
}