function translation_entity_types_translatable

Returns all the translatable entity types.

Return value

array An array of entity types keyed by entity type.

File

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

Code

function translation_entity_types_translatable() {
  $entity_types =& drupal_static(__FUNCTION__, array());
  foreach (entity_get_info() as $entity_type => $info) {
    if (translation_entity_enabled($entity_type)) {

      // Lazy load router items.
      if (!isset($items)) {
        $items = menu_get_router();
      }

      // Check whether the required paths are defined. We need to strip out the
      // menu loader and replace it with a plain "%" as router items have no
      // menu loader in them.
      $path = _translation_entity_menu_strip_loaders($info['menu_base_path']);
      if (!empty($items[$path]) && !empty($items[$path . '/translations'])) {
        $entity_types[$entity_type] = $entity_type;
      }
    }
  }
  return $entity_types;
}