You are here

public function ContentEntitySource::getItemTypes in Translation Management Tool 8

Returns an array of translatable source item types.

Overrides SourcePluginBase::getItemTypes

1 call to ContentEntitySource::getItemTypes()
ContentEntitySource::continuousSettingsForm in sources/content/src/Plugin/tmgmt/Source/ContentEntitySource.php
Creates "Continuous settings" form element.

File

sources/content/src/Plugin/tmgmt/Source/ContentEntitySource.php, line 410

Class

ContentEntitySource
Content entity source plugin controller.

Namespace

Drupal\tmgmt_content\Plugin\tmgmt\Source

Code

public function getItemTypes() {
  $entity_types = \Drupal::entityTypeManager()
    ->getDefinitions();
  $types = array();
  $content_translation_manager = \Drupal::service('content_translation.manager');
  foreach ($entity_types as $entity_type_name => $entity_type) {

    // Entity types with this key set are considered composite entities and
    // always embedded in others. Do not expose them as their own item type.
    if ($entity_type
      ->get('entity_revision_parent_type_field')) {
      continue;
    }
    if ($content_translation_manager
      ->isEnabled($entity_type
      ->id())) {
      $types[$entity_type_name] = $entity_type
        ->getLabel();
    }
  }
  return $types;
}