if (!
$entity->
isDefaultRevision() && ContentTranslationManager::
isPendingRevisionSupportEnabled($entity_type_id,
$entity->
bundle())) { /** @var \Drupal\Core\Entity\ContentEntityStorageInterface $storage */
$storage =
$this->
entityTypeManager()->
getStorage($entity->
getEntityTypeId());
$revision_id =
$storage->
getLatestTranslationAffectedRevisionId($entity->
id(),
$source->
getId());
if ($revision_id !=
$entity->
getRevisionId()) { $entity =
$storage->
loadRevision($revision_id);
} } // @todo Exploit the upcoming hook_entity_prepare() when available.
// See https://www.drupal.org/node/1810394.
$this->
prepareTranslation($entity,
$source,
$target);
// @todo Provide a way to figure out the default form operation. Maybe like
// $operation = isset($info['default_operation']) ? $info['default_operation'] : 'default';
// See https://www.drupal.org/node/2006348.
// Use the add form handler, if available, otherwise default.
$operation =
$entity->
getEntityType()->
hasHandlerClass('form', 'add'
) ? 'add' : 'default';
$form_state_additions =
[];
$form_state_additions['langcode'
] =
$target->
getId();
$form_state_additions['content_translation'
]['source'
] =
$source;