// 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;
$form_state_additions['content_translation'
]['target'
] =
$target;
$form_state_additions['content_translation'
]['translation_form'
] = !
$entity->
access('update'
);
return $this->
entityFormBuilder()->
getForm($entity,
$operation,
$form_state_additions);
} /**
* Builds the edit translation page.
*
* @param \Drupal\Core\Language\LanguageInterface $language
* The language of the translated values. Defaults to the current content
* language.
* @param \Drupal\Core\Routing\RouteMatchInterface $route_match
* The route match object from which to extract the entity type.
* @param string $entity_type_id
* (optional) The entity type ID.
*
* @return array
* A processed form array ready to be rendered.
*/