function CommentTranslationHandler::entityFormAlter

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

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;
    }
}

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