public function CommentTranslationHandler::entityFormEntityBuild in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/comment/src/CommentTranslationHandler.php \Drupal\comment\CommentTranslationHandler::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.
Overrides ContentTranslationHandler::entityFormEntityBuild
See also
\Drupal\content_translation\ContentTranslationHandler::entityFormAlter()
File
- core/modules/ comment/ src/ CommentTranslationHandler.php, line 44 
- Contains \Drupal\comment\CommentTranslationHandler.
Class
- CommentTranslationHandler
- Defines the translation handler for comments.
Namespace
Drupal\commentCode
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);
}