function translation_entity_enabled

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.

Parameters

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.

boolean $skip_handler: (optional) Specifies whether the availablity of a field translation handler should affect the returned value. By default the check is performed.

11 calls to translation_entity_enabled()
translation_entity_entity_delete in drupal/core/modules/translation_entity/translation_entity.module
Implements hook_entity_delete().
translation_entity_entity_insert in drupal/core/modules/translation_entity/translation_entity.module
Implements hook_entity_insert().
translation_entity_entity_load in drupal/core/modules/translation_entity/translation_entity.module
Implements hook_entity_load().
translation_entity_entity_update in drupal/core/modules/translation_entity/translation_entity.module
Implements hook_entity_update().
translation_entity_field_extra_fields in drupal/core/modules/translation_entity/translation_entity.module
Implements hook_field_extra_fields().

... See full list

File

drupal/core/modules/translation_entity/translation_entity.module, line 331
Allows entities to be translated into different languages.

Code

function translation_entity_enabled($entity_type, $bundle = NULL, $skip_handler = FALSE) {
  $enabled = FALSE;
  $bundles = !empty($bundle) ? array(
    $bundle,
  ) : entity_get_bundles($entity_type);
  foreach ($bundles as $bundle) {
    if (translation_entity_get_config($entity_type, $bundle, 'enabled')) {
      $enabled = TRUE;
      break;
    }
  }
  return $enabled && ($skip_handler || field_has_translation_handler($entity_type, 'translation_entity'));
}