You are here

public function TermTranslationHandler::entityFormEntityBuild in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/taxonomy/src/TermTranslationHandler.php \Drupal\taxonomy\TermTranslationHandler::entityFormEntityBuild()

Entity builder method.

Parameters

string $entity_type: The type of the entity.

\Drupal\Core\Entity\EntityInterface $entity: The entity whose form is being built.

array $form: A nested array form elements comprising the form.

\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.

Overrides ContentTranslationHandler::entityFormEntityBuild

See also

\Drupal\content_translation\ContentTranslationHandler::entityFormAlter()

File

core/modules/taxonomy/src/TermTranslationHandler.php, line 45

Class

TermTranslationHandler
Defines the translation handler for terms.

Namespace

Drupal\taxonomy

Code

public function entityFormEntityBuild($entity_type, EntityInterface $entity, array $form, FormStateInterface $form_state) {
  if ($form_state
    ->hasValue('content_translation')) {
    $translation =& $form_state
      ->getValue('content_translation');
    $translation['status'] = $entity
      ->isPublished();
  }
  parent::entityFormEntityBuild($entity_type, $entity, $form, $form_state);
}