You are here

function lingotek_managed_entity_types in Lingotek Translation 7.6

Same name and namespace in other branches
  1. 7.7 lingotek.util.inc \lingotek_managed_entity_types()
  2. 7.4 lingotek.util.inc \lingotek_managed_entity_types()
  3. 7.5 lingotek.util.inc \lingotek_managed_entity_types()

Return a whitelist of entity types supported for translation by the Lingotek module

9 calls to lingotek_managed_entity_types()
LingotekSync::getCountsByStatus in lib/Drupal/lingotek/LingotekSync.php
LingotekSync::getEntitySourceCount in lib/Drupal/lingotek/LingotekSync.php
LingotekSync::getEntityTargetCountByStatus in lib/Drupal/lingotek/LingotekSync.php
Get a count of translation targets by entity and status.
LingotekSync::getSourceCounts in lib/Drupal/lingotek/LingotekSync.php
lingotek_admin_configuration_view in ./lingotek.admin.inc

... See full list

File

./lingotek.util.inc, line 644
Utility functions.

Code

function lingotek_managed_entity_types($include_all = FALSE) {
  $type_info = entity_get_info();
  $whitelist = array(
    'node',
    'comment',
    'message_type',
    'fieldable_panels_pane',
  );

  // supported types
  if ($include_all) {

    // include the entities that should not normally be managed separately
    if (module_exists('field_collection')) {
      $whitelist[] = 'field_collection_item';
    }
  }
  if (module_exists('taxonomy') && variable_get('lingotek_advanced_taxonomy_terms', FALSE)) {
    $whitelist[] = 'taxonomy_term';
  }
  $whitelist = array_flip($whitelist);
  $enabled_types = array_intersect_key($type_info, $whitelist);

  // labels
  if (isset($enabled_types['comment'])) {
    $enabled_types['comment']['label'] = 'Comments';
  }
  if (isset($enabled_types['node'])) {
    $enabled_types['node']['label'] = 'Nodes';
  }
  if (isset($enabled_types['message_type'])) {
    $enabled_types['message_type']['label'] = 'Message Types';
  }
  if (isset($enabled_types['field_collection_item'])) {
    $enabled_types['field_collection_item']['label'] = 'Field Collections';
  }
  if (isset($enabled_types['taxonomy_term'])) {
    $enabled_types['taxonomy_term']['label'] = 'Taxonomy Terms';
  }
  if (isset($enabled_types['fieldable_panels_pane'])) {
    $enabled_types['fieldable_panels_pane']['label'] = 'Fieldable Panels Panes';
  }

  // Allow other modules to add/remove entity types to the list supported.
  drupal_alter('lingotek_managed_entity_types', $enabled_types, $include_all);
  return $enabled_types;
}