Returns an array of translatable source item types.
Overrides SourcePluginBase::getItemTypes
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;
}