Determines whether the given entity type is translatable.
@returns TRUE if the specified bundle is translatable. If no bundle is provided returns TRUE if at least one of the entity bundles is translatable.
string $entity_type: The type of the entity.
string $bundle: (optional) The bundle of the entity. If no bundle is provided, all the available bundles are checked.
function translation_entity_enabled($entity_type, $bundle = NULL) {
$enabled = FALSE;
$info = entity_get_info($entity_type);
if (!empty($info['translatable'])) {
$bundles = !empty($bundle) ? array(
$bundle,
) : array_keys(entity_get_bundles($entity_type));
foreach ($bundles as $bundle) {
if (translation_entity_get_config($entity_type, $bundle, 'enabled')) {
$enabled = TRUE;
break;
}
}
}
return $enabled;
}