function content_translation_entity_extra_field_info

Same name and namespace in other branches
  1. 9 core/modules/content_translation/content_translation.module \content_translation_entity_extra_field_info()
  2. 8.9.x core/modules/content_translation/content_translation.module \content_translation_entity_extra_field_info()
  3. 10 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

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

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