content_translation_entity_extra_field_info

content_translation_entity_extra_field_info()

Implements hook_entity_extra_field_info().

File

core/modules/content_translation/content_translation.module, line 352
Allows entities to be translated into different languages.

Code

function content_translation_entity_extra_field_info() {
  $extra = array();
  $bundle_info_service = \Drupal::service('entity_type.bundle.info');
  foreach (\Drupal::entityManager()->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'] = array(
          'label' => t('Translation'),
          'description' => t('Translation settings'),
          'weight' => 10,
        );
      }
    }
  }

  return $extra;
}
doc_Drupal
2016-10-29 08:58:37
Comments
Leave a Comment

Please login to continue.