--- /dev/null
+/**
+ * Implements hook_entity_extra_field_info().
+ */
+function {{ machine_name }}_entity_extra_field_info() {
+ $extra = [];
+ $module_language_enabled = \Drupal::moduleHandler()->moduleExists('language');
+ $description = t('Node module element');
+
+ foreach (NodeType::loadMultiple() as $bundle) {
+
+ // Add also the 'language' select if Language module is enabled and the
+ // bundle has multilingual support.
+ // Visibility of the ordering of the language selector is the same as on the
+ // node/add form.
+ if ($module_language_enabled) {
+ $configuration = ContentLanguageSettings::loadByEntityTypeBundle('node', $bundle->id());
+ if ($configuration->isLanguageAlterable()) {
+ $extra['node'][$bundle->id()]['form']['language'] = [
+ 'label' => t('Language'),
+ 'description' => $description,
+ 'weight' => 0,
+ ];
+ }
+ }
+ $extra['node'][$bundle->id()]['display']['language'] = [
+ 'label' => t('Language'),
+ 'description' => $description,
+ 'weight' => 0,
+ 'visible' => FALSE,
+ ];
+ }
+
+ return $extra;
+}