Commit 4c2bd968 authored by webchick's avatar webchick

Issue #1074672 by claudiu.cristea, boran, tim.plunkett, webflo, Schnitzel,...

Issue #1074672 by claudiu.cristea, boran, tim.plunkett, webflo, Schnitzel, mikewink: Added Allow language select to be rearranged inside node form.
parent 62b1f23e
......@@ -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 @@ function testNodeTypeInitialLanguageDefaults() {
$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 @@ function testNodeTypeInitialLanguageDefaults() {
$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',
......
......@@ -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,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment