summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwebchick2012-08-26 16:23:29 (GMT)
committerwebchick2012-08-26 16:23:29 (GMT)
commit4c2bd9686455ee5d6281255d26ca2c707f2a0a58 (patch)
tree2e5f1b66219066643b044684d4c13bf77dcf0514
parent62b1f23eec32842b75180ebe19b38adad48ee5c2 (diff)
Issue #1074672 by claudiu.cristea, boran, tim.plunkett, webflo, Schnitzel, mikewink: Added Allow language select to be rearranged inside node form.
-rw-r--r--core/modules/node/lib/Drupal/node/Tests/NodeTypeInitialLanguageTest.php12
-rw-r--r--core/modules/node/node.module4
2 files changed, 14 insertions, 2 deletions
diff --git a/core/modules/node/lib/Drupal/node/Tests/NodeTypeInitialLanguageTest.php b/core/modules/node/lib/Drupal/node/Tests/NodeTypeInitialLanguageTest.php
index 434384f..3ba3fe6 100644
--- a/core/modules/node/lib/Drupal/node/Tests/NodeTypeInitialLanguageTest.php
+++ b/core/modules/node/lib/Drupal/node/Tests/NodeTypeInitialLanguageTest.php
@@ -17,7 +17,7 @@ class NodeTypeInitialLanguageTest extends NodeTestBase {
*
* @var array
*/
- public static $modules = array('language');
+ public static $modules = array('language', 'field_ui');
public static function getInfo() {
return array(
@@ -45,6 +45,11 @@ class NodeTypeInitialLanguageTest extends NodeTestBase {
$this->assertOptionSelected('edit-node-type-language-default', 'site_default', 'The default inital language is the site default.');
$this->assertFieldChecked('edit-node-type-language-hidden', 'Language selector is hidden by default.');
+ // Tests if the language field cannot be rearranged on the manage fields tab.
+ $this->drupalGet('admin/structure/types/manage/article/fields');
+ $language_field = $this->xpath('//*[@id="field-overview"]/*[@id="language"]');
+ $this->assert(empty($language_field), 'Language field is not visible on manage fields tab.');
+
$this->drupalGet('node/add/article');
$this->assertNoField('langcode', 'Language is not selectable on node add/edit page by default.');
@@ -68,6 +73,11 @@ class NodeTypeInitialLanguageTest extends NodeTestBase {
$this->assertField('langcode', 'Language is selectable on node add/edit page when language not hidden.');
$this->assertOptionSelected('edit-langcode', 'hu', 'The inital language is the site default on the node add page after the site default language is changed.');
+ // Tests if the language field can be rearranged on the manage fields tab.
+ $this->drupalGet('admin/structure/types/manage/article/fields');
+ $language_field = $this->xpath('//*[@id="language"]');
+ $this->assert(!empty($language_field), 'Language field is visible on manage fields tab.');
+
// Changes the inital language settings.
$edit = array(
'node_type_language_default' => 'en',
diff --git a/core/modules/node/node.module b/core/modules/node/node.module
index 349aab5..03e566c 100644
--- a/core/modules/node/node.module
+++ b/core/modules/node/node.module
@@ -654,7 +654,9 @@ function node_field_extra_fields() {
// Add also the 'language' select if Language module is enabled and the
// bundle has multilingual support.
- if ($module_language_enabled && variable_get('node_type_language_' . $bundle->type, 0)) {
+ // Visibility of the ordering of the language selector is the same as on the node/add form,
+ // i.e. node_type_language_hidden_TYPE variable
+ if ($module_language_enabled && !variable_get('node_type_language_hidden_' . $bundle->type, TRUE)) {
$extra['node'][$bundle->type]['form']['language'] = array(
'label' => t('Language'),
'description' => $description,