You are here

function content_translation_entity_extra_field_info in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 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 344
Allows entities to be translated into different languages.

Code

function content_translation_entity_extra_field_info() {
  $extra = array();
  foreach (\Drupal::entityManager()
    ->getDefinitions() as $entity_type => $info) {
    foreach (entity_get_bundles($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;
}