function CommentTestHooks::entityTypeAlter
Implements hook_entity_type_alter().
File
-
core/
modules/ comment/ tests/ modules/ comment_test/ src/ Hook/ CommentTestHooks.php, line 19
Class
- CommentTestHooks
- Hook implementations for comment_test.
Namespace
Drupal\comment_test\HookCode
public function entityTypeAlter(array &$entity_types) : void {
/** @var \Drupal\Core\Entity\EntityTypeInterface[] $entity_types */
if (\Drupal::languageManager()->isMultilingual()) {
// Enable language handling for comment fields.
$translation = $entity_types['comment']->get('translation');
$translation['comment_test'] = TRUE;
$entity_types['comment']->set('translation', $translation);
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.