From c2f96c00c2abcf4aefba61fa3d0f65e1c675644b Mon Sep 17 00:00:00 2001
From: Claudiu Cristea <clau.cristea@gmail.com>
Date: Sun, 6 Nov 2011 15:05:09 +0200
Subject: [PATCH] #1074672 by claudiu.cristea, mikewink: Added Allow language
 select to be rearranged inside node form.

---
 core/modules/node/node.module |   28 ++++++++++++++++++----------
 1 files changed, 18 insertions(+), 10 deletions(-)

diff --git a/core/modules/node/node.module b/core/modules/node/node.module
index 0c3cfb7..bcd7aa5 100644
--- a/core/modules/node/node.module
+++ b/core/modules/node/node.module
@@ -590,17 +590,25 @@ function node_add_body_field($type, $label = 'Body') {
  */
 function node_field_extra_fields() {
   $extra = array();
+  $locale_enabled = module_exists('locale');
+  $description = t('Node module element');
+
+  foreach (node_type_get_types() as $bundle) {
+    if ($bundle->has_title) {
+      $extra['node'][$bundle->type]['form']['title'] = array(
+        'label' => $bundle->title_label,
+        'description' => $description,
+        'weight' => -5,
+      );
+    }
 
-  foreach (node_type_get_types() as $type) {
-    if ($type->has_title) {
-      $extra['node'][$type->type] = array(
-        'form' => array(
-          'title' => array(
-            'label' => $type->title_label,
-            'description' => t('Node module element'),
-            'weight' => -5,
-          ),
-        ),
+    // Add also the language select if Locale module is enabled and the bundle
+    // has multiligual support.
+    if ($locale_enabled && variable_get('language_content_type_' . $bundle->type, 0)) {
+      $extra['node'][$bundle->type]['form']['language'] = array(
+        'label' => t('Language'),
+        'description' => $description,
+        'weight' => 0,
       );
     }
   }
-- 
1.7.5.4

