function CommentTranslationHandler::entityFormEntityBuild

Same name and namespace in other branches
  1. 9 core/modules/comment/src/CommentTranslationHandler.php \Drupal\comment\CommentTranslationHandler::entityFormEntityBuild()
  2. 8.9.x core/modules/comment/src/CommentTranslationHandler.php \Drupal\comment\CommentTranslationHandler::entityFormEntityBuild()
  3. 10 core/modules/comment/src/CommentTranslationHandler.php \Drupal\comment\CommentTranslationHandler::entityFormEntityBuild()

Overrides ContentTranslationHandler::entityFormEntityBuild

File

core/modules/comment/src/CommentTranslationHandler.php, line 39

Class

CommentTranslationHandler
Defines the translation handler for comments.

Namespace

Drupal\comment

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');
        
        /** @var \Drupal\comment\CommentInterface $entity */
        $translation['status'] = $entity->isPublished();
        $translation['name'] = $entity->getAuthorName();
    }
    parent::entityFormEntityBuild($entity_type, $entity, $form, $form_state);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.