Same name and namespace in other branches
- 8.9.x core/modules/content_translation/content_translation.module \content_translation_entity_extra_field_info()
- 9 core/modules/content_translation/content_translation.module \content_translation_entity_extra_field_info()
Implements hook_entity_extra_field_info().
File
- core/
modules/ content_translation/ content_translation.module, line 465 - Allows entities to be translated into different languages.
Code
function content_translation_entity_extra_field_info() {
$extra = [];
$bundle_info_service = \Drupal::service('entity_type.bundle.info');
foreach (\Drupal::entityTypeManager()
->getDefinitions() as $entity_type => $info) {
foreach ($bundle_info_service
->getBundleInfo($entity_type) as $bundle => $bundle_info) {
if (\Drupal::service('content_translation.manager')
->isEnabled($entity_type, $bundle)) {
$extra[$entity_type][$bundle]['form']['translation'] = [
'label' => t('Translation'),
'description' => t('Translation settings'),
'weight' => 10,
];
}
}
}
return $extra;
}