예제 #1
0
 /**
  * {@inheritdoc}
  */
 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);
 }
예제 #2
0
 /**
  * {@inheritdoc}
  */
 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();
         $account = $entity->uid->entity;
         $translation['uid'] = $account ? $account->id() : 0;
         $translation['created'] = format_date($entity->created->value, 'custom', 'Y-m-d H:i:s O');
     }
     parent::entityFormEntityBuild($entity_type, $entity, $form, $form_state);
 }
예제 #3
0
 /**
  * {@inheritdoc}
  */
 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();
         // $form['content_translation']['name'] is the equivalent field
         // for translation author uid.
         $account = $entity->uid->entity;
         $translation['name'] = $account ? $account->getUsername() : '';
         $translation['created'] = format_date($entity->created->value, 'custom', 'Y-m-d H:i:s O');
     }
     parent::entityFormEntityBuild($entity_type, $entity, $form, $form_state);
 }
 /**
  * {@inheritdoc}
  */
 public function entityFormEntityBuild($entity_type, EntityInterface $entity, array $form, FormStateInterface $form_state)
 {
     if (isset($form_state['values']['content_translation'])) {
         $form_controller = content_translation_form_controller($form_state);
         $translation =& $form_state['values']['content_translation'];
         $translation['status'] = $form_controller->getEntity()->isPublished();
         // $form['content_translation']['name'] is the equivalent field
         // for translation author uid.
         $translation['name'] = $form_state['values']['uid'];
         $translation['created'] = $form_state['values']['created'];
     }
     parent::entityFormEntityBuild($entity_type, $entity, $form, $form_state);
 }