CommentTranslationHandler::entityFormAlter

public CommentTranslationHandler::entityFormAlter(array &$form, FormStateInterface $form_state, EntityInterface $entity)

Performs the needed alterations to the entity form.

Parameters

array $form: The entity form to be altered to provide the translation workflow.

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

\Drupal\Core\Entity\EntityInterface $entity: The entity being created or edited.

Overrides ContentTranslationHandler::entityFormAlter

File

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

Class

CommentTranslationHandler
Defines the translation handler for comments.

Namespace

Drupal\comment

Code

public function entityFormAlter(array &$form, FormStateInterface $form_state, EntityInterface $entity) {
  parent::entityFormAlter($form, $form_state, $entity);

  if (isset($form['content_translation'])) {
    // We do not need to show these values on comment forms: they inherit the
    // basic comment property values.
    $form['content_translation']['status']['#access'] = FALSE;
    $form['content_translation']['name']['#access'] = FALSE;
    $form['content_translation']['created']['#access'] = FALSE;
  }
}
doc_Drupal
2016-10-29 08:51:06
Comments
Leave a Comment

Please login to continue.