Commit 3acfe361 authored by webchick's avatar webchick

Issue #1164852 by plach: Default the 'translatable' bit on fields to FALSE for...

Issue #1164852 by plach: Default the 'translatable' bit on fields to FALSE for fields created in the UI, to match those created by the API.
parent c7caef6a
......@@ -464,7 +464,7 @@ class TextTranslationTestCase extends DrupalWebTestCase {
$node = $this->drupalGetNodeByTitle($edit['title']);
$this->drupalGet("node/$node->nid/translate");
$this->clickLink(t('add translation'));
$this->assertFieldByXPath("//textarea[@name='body[fr][0][value]']", $body, t('The textfield widget is populated.'));
$this->assertFieldByXPath("//textarea[@name='body[$langcode][0][value]']", $body, t('The textfield widget is populated.'));
}
/**
......@@ -484,17 +484,17 @@ class TextTranslationTestCase extends DrupalWebTestCase {
);
// Create an article with the first body input format set to "Full HTML".
$langcode = 'en';
$title = $this->randomName();
$edit = array(
'title' => $title,
'language' => $langcode,
'language' => 'en',
);
$this->drupalPost('node/add/article', $edit, t('Save'));
// Populate the body field: the first item gets the "Full HTML" input
// format, the second one "Filtered HTML".
$formats = array('full_html', 'filtered_html');
$langcode = LANGUAGE_NONE;
foreach ($body as $delta => $value) {
$edit = array(
"body[$langcode][$delta][value]" => $value,
......
......@@ -509,6 +509,10 @@ function field_ui_field_overview_form($form, &$form_state, $entity_type, $bundle
'#cell_attributes' => array('colspan' => 3),
'#prefix' => '<div class="add-new-placeholder">&nbsp;</div>',
),
'translatable' => array(
'#type' => 'value',
'#value' => FALSE,
),
);
}
......@@ -753,7 +757,7 @@ function field_ui_field_overview_form_submit($form, &$form_state) {
$field = array(
'field_name' => $values['field_name'],
'type' => $values['type'],
'translatable' => TRUE,
'translatable' => $values['translatable'],
);
$instance = array(
'field_name' => $field['field_name'],
......
......@@ -2137,6 +2137,11 @@ class LocaleMultilingualFieldsFunctionalTest extends DrupalWebTestCase {
);
$this->drupalPost('admin/structure/types/manage/page', $edit, t('Save content type'));
$this->assertRaw(t('The content type %type has been updated.', array('%type' => 'Basic page')), t('Basic page content type has been updated.'));
// Make node body translatable.
$field = field_info_field('body');
$field['translatable'] = TRUE;
field_update_field($field);
}
/**
......
......@@ -558,7 +558,6 @@ function node_add_body_field($type, $label = 'Body') {
'field_name' => 'body',
'type' => 'text_with_summary',
'entity_types' => array('node'),
'translatable' => TRUE,
);
$field = field_create_field($field);
}
......
......@@ -279,8 +279,9 @@ class PathLanguageTestCase extends DrupalWebTestCase {
$this->drupalGet('node/' . $english_node->nid . '/translate');
$this->clickLink(t('add translation'));
$edit = array();
$langcode = LANGUAGE_NONE;
$edit["title"] = $this->randomName();
$edit["body[fr][0][value]"] = $this->randomName();
$edit["body[$langcode][0][value]"] = $this->randomName();
$french_alias = $this->randomName();
$edit['path[alias]'] = $french_alias;
$this->drupalPost(NULL, $edit, t('Save'));
......
......@@ -108,9 +108,9 @@ class TranslationTestCase extends DrupalWebTestCase {
// Update original and mark translation as outdated.
$node_body = $this->randomName();
$node->body[$node->language][0]['value'] = $node_body;
$node->body[LANGUAGE_NONE][0]['value'] = $node_body;
$edit = array();
$edit["body[$node->language][0][value]"] = $node_body;
$edit["body[$langcode][0][value]"] = $node_body;
$edit['translation[retranslate]'] = TRUE;
$this->drupalPost('node/' . $node->nid . '/edit', $edit, t('Save'));
$this->assertRaw(t('Basic page %title has been updated.', array('%title' => $node_title)), t('Original node updated.'));
......@@ -121,7 +121,7 @@ class TranslationTestCase extends DrupalWebTestCase {
// Update translation and mark as updated.
$edit = array();
$edit["body[$node_translation->language][0][value]"] = $this->randomName();
$edit["body[$langcode][0][value]"] = $this->randomName();
$edit['translation[status]'] = FALSE;
$this->drupalPost('node/' . $node_translation->nid . '/edit', $edit, t('Save'));
$this->assertRaw(t('Basic page %title has been updated.', array('%title' => $node_translation_title)), t('Translated node updated.'));
......@@ -131,7 +131,7 @@ class TranslationTestCase extends DrupalWebTestCase {
$this->drupalGet('node/add/page');
$this->assertFieldByXPath('//select[@name="language"]//option', 'it', t('Italian (disabled) is available in language selection.'));
$translation_it = $this->createTranslation($node, $this->randomName(), $this->randomName(), 'it');
$this->assertRaw($translation_it->body['it'][0]['value'], t('Content created in Italian (disabled).'));
$this->assertRaw($translation_it->body[LANGUAGE_NONE][0]['value'], t('Content created in Italian (disabled).'));
// Confirm that language neutral is an option for translators when there are
// disabled languages.
......@@ -349,9 +349,10 @@ class TranslationTestCase extends DrupalWebTestCase {
function createTranslation($node, $title, $body, $language) {
$this->drupalGet('node/add/page', array('query' => array('translation' => $node->nid, 'target' => $language)));
$body_key = "body[$language][0][value]";
$langcode = LANGUAGE_NONE;
$body_key = "body[$langcode][0][value]";
$this->assertFieldByXPath('//input[@id="edit-title"]', $node->title, "Original title value correctly populated.");
$this->assertFieldByXPath("//textarea[@name='$body_key']", $node->body[$node->language][0]['value'], "Original body value correctly populated.");
$this->assertFieldByXPath("//textarea[@name='$body_key']", $node->body[LANGUAGE_NONE][0]['value'], "Original body value correctly populated.");
$edit = array();
$edit["title"] = $title;
......
......@@ -327,7 +327,6 @@ function standard_install() {
'field_name' => 'field_image',
'type' => 'image',
'cardinality' => 1,
'translatable' => TRUE,
'locked' => FALSE,
'indexes' => array('fid' => array('fid')),
'settings' => array(
......
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