summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAngie Byron <webchick@24967.no-reply.drupal.org>2009-10-11 03:07:21 +0000
committerAngie Byron <webchick@24967.no-reply.drupal.org>2009-10-11 03:07:21 +0000
commitb3265dbe174ce0efefa181b8af6c1eaea3ff22c2 (patch)
treeaa7e8b709c162fd781748d8bebaa12c75727e01e
parent64a1a0d67eb5aecc8e6d78469b19f58e8443c717 (diff)
downloadbrdo-b3265dbe174ce0efefa181b8af6c1eaea3ff22c2.tar.gz
brdo-b3265dbe174ce0efefa181b8af6c1eaea3ff22c2.tar.bz2
#557292 by peximo, plach, catch, and yched: Convert node title to Field API.
-rw-r--r--modules/aggregator/aggregator.test2
-rw-r--r--modules/blog/blog.test10
-rw-r--r--modules/book/book.admin.inc12
-rw-r--r--modules/book/book.module8
-rw-r--r--modules/book/book.pages.inc6
-rw-r--r--modules/book/book.test12
-rw-r--r--modules/comment/comment.pages.inc2
-rw-r--r--modules/comment/comment.tokens.inc3
-rw-r--r--modules/dblog/dblog.test9
-rw-r--r--modules/file/tests/file.test8
-rw-r--r--modules/filter/filter.test6
-rw-r--r--modules/forum/forum.module5
-rw-r--r--modules/forum/forum.test12
-rw-r--r--modules/locale/locale.test6
-rw-r--r--modules/menu/menu.module4
-rw-r--r--modules/menu/menu.test4
-rw-r--r--modules/node/node.admin.inc2
-rw-r--r--modules/node/node.install5
-rw-r--r--modules/node/node.module138
-rw-r--r--modules/node/node.pages.inc25
-rw-r--r--modules/node/node.test142
-rw-r--r--modules/node/node.tokens.inc2
-rw-r--r--modules/node/node.tpl.php2
-rw-r--r--modules/path/path.test18
-rw-r--r--modules/php/php.test2
-rw-r--r--modules/poll/poll.module12
-rw-r--r--modules/poll/poll.pages.inc4
-rw-r--r--modules/poll/poll.test6
-rw-r--r--modules/search/search.api.php4
-rw-r--r--modules/search/search.test14
-rw-r--r--modules/simpletest/drupal_web_test_case.php2
-rw-r--r--modules/statistics/statistics.pages.inc2
-rw-r--r--modules/system/system.api.php2
-rw-r--r--modules/system/system.test24
-rw-r--r--modules/system/system.tokens.inc2
-rw-r--r--modules/taxonomy/taxonomy.test8
-rw-r--r--modules/tracker/tracker.test49
-rw-r--r--modules/translation/translation.module2
-rw-r--r--modules/translation/translation.pages.inc4
-rw-r--r--modules/translation/translation.test16
-rw-r--r--modules/trigger/trigger.test6
-rw-r--r--modules/upload/upload.test6
-rw-r--r--themes/garland/node.tpl.php2
43 files changed, 347 insertions, 263 deletions
diff --git a/modules/aggregator/aggregator.test b/modules/aggregator/aggregator.test
index d3162ff15..17934ca50 100644
--- a/modules/aggregator/aggregator.test
+++ b/modules/aggregator/aggregator.test
@@ -253,7 +253,7 @@ EOF;
// Post 5 articles.
for ($i = 0; $i < 5; $i++) {
$edit = array();
- $edit['title'] = $this->randomName();
+ $edit["title[$langcode][0][value]"] = $this->randomName();
$edit["body[$langcode][0][value]"] = $this->randomName();
$this->drupalPost('node/add/article', $edit, t('Save'));
}
diff --git a/modules/blog/blog.test b/modules/blog/blog.test
index a5def9a61..661bbd4af 100644
--- a/modules/blog/blog.test
+++ b/modules/blog/blog.test
@@ -138,29 +138,29 @@ class BlogTestCase extends DrupalWebTestCase {
// View blog node.
$this->drupalGet('node/' . $node->nid);
$this->assertResponse(200);
- $this->assertTitle($node->title . ' | Drupal', t('Blog node was displayed'));
+ $this->assertTitle($node->title[FIELD_LANGUAGE_NONE][0]['value'] . ' | Drupal', t('Blog node was displayed'));
$this->assertText(t('Home ' . $crumb . ' Blogs ' . $crumb . ' @name' . $quote . 's blog', array('@name' => $node_user->name)), t('Breadcrumbs were displayed'));
// View blog edit node.
$this->drupalGet('node/' . $node->nid . '/edit');
$this->assertResponse($response);
if ($response == 200) {
- $this->assertTitle('Edit Blog entry ' . $node->title . ' | Drupal', t('Blog edit node was displayed'));
+ $this->assertTitle('Edit Blog entry ' . $node->title[FIELD_LANGUAGE_NONE][0]['value'] . ' | Drupal', t('Blog edit node was displayed'));
}
if ($response == 200) {
// Edit blog node.
$edit = array();
- $edit['title'] = 'node/' . $node->nid;
$langcode = FIELD_LANGUAGE_NONE;
+ $edit["title[$langcode][0][value]"] = 'node/' . $node->nid;
$edit["body[$langcode][0][value]"] = $this->randomName(256);
$this->drupalPost('node/' . $node->nid . '/edit', $edit, t('Save'));
- $this->assertRaw(t('Blog entry %title has been updated.', array('%title' => $edit['title'])), t('Blog node was edited'));
+ $this->assertRaw(t('Blog entry %title has been updated.', array('%title' => $edit["title[$langcode][0][value]"])), t('Blog node was edited'));
// Delete blog node.
$this->drupalPost('node/' . $node->nid . '/delete', array(), t('Delete'));
$this->assertResponse($response);
- $this->assertRaw(t('Blog entry %title has been deleted.', array('%title' => $edit['title'])), t('Blog node was deleted'));
+ $this->assertRaw(t('Blog entry %title has been deleted.', array('%title' => $edit["title[$langcode][0][value]"])), t('Blog node was deleted'));
}
}
diff --git a/modules/book/book.admin.inc b/modules/book/book.admin.inc
index b6a7e9b5d..072908862 100644
--- a/modules/book/book.admin.inc
+++ b/modules/book/book.admin.inc
@@ -78,7 +78,7 @@ function book_admin_settings_validate($form, &$form_state) {
* @ingroup forms.
*/
function book_admin_edit($form, $form_state, $node) {
- drupal_set_title($node->title);
+ drupal_set_title($node->title[FIELD_LANGUAGE_NONE][0]['value']);
$form['#node'] = $node;
_book_admin_table($node, $form);
$form['save'] = array(
@@ -131,17 +131,19 @@ function book_admin_edit_submit($form, &$form_state) {
// Update the title if changed.
if ($row['title']['#default_value'] != $values['title']) {
$node = node_load($values['nid'], FALSE);
- $node->title = $values['title'];
+ $langcode = FIELD_LANGUAGE_NONE;
+ $node->title = array($langcode => array(array('value' => $values['title'])));
$node->book['link_title'] = $values['title'];
$node->revision = 1;
- $node->log = t('Title changed from %original to %current.', array('%original' => $node->title, '%current' => $values['title']));
+ $node->log = t('Title changed from %original to %current.', array('%original' => $node->title[$langcode][0]['value'], '%current' => $values['title']));
+
node_save($node);
- watchdog('content', 'book: updated %title.', array('%title' => $node->title), WATCHDOG_NOTICE, l(t('view'), 'node/' . $node->nid));
+ watchdog('content', 'book: updated %title.', array('%title' => $node->title[$langcode][0]['value']), WATCHDOG_NOTICE, l(t('view'), 'node/' . $node->nid));
}
}
}
- drupal_set_message(t('Updated book %title.', array('%title' => $form['#node']->title)));
+ drupal_set_message(t('Updated book %title.', array('%title' => $form['#node']->title[$langcode][0]['value'])));
}
/**
diff --git a/modules/book/book.module b/modules/book/book.module
index 3adb48741..1daf7d657 100644
--- a/modules/book/book.module
+++ b/modules/book/book.module
@@ -477,7 +477,7 @@ function _book_add_form_elements(&$form, $node) {
if (isset($node->nid) && ($nid == $node->book['original_bid']) && ($node->book['parent_depth_limit'] == 0)) {
// This is the top level node in a maximum depth book and thus cannot be moved.
- $options[$node->nid] = $node->title;
+ $options[$node->nid] = $node->title[FIELD_LANGUAGE_NONE][0]['value'];
}
else {
foreach (book_get_books() as $book) {
@@ -526,7 +526,7 @@ function _book_update_outline($node) {
$new = empty($node->book['mlid']);
$node->book['link_path'] = 'node/' . $node->nid;
- $node->book['link_title'] = $node->title;
+ $node->book['link_title'] = $node->title[FIELD_LANGUAGE_NONE][0]['value'];
$node->book['parent_mismatch'] = FALSE; // The normal case.
if ($node->book['bid'] == $node->nid) {
@@ -882,7 +882,7 @@ function book_form_node_delete_confirm_alter(&$form, $form_state) {
if (isset($node->book) && $node->book['has_children']) {
$form['book_warning'] = array(
- '#markup' => '<p>' . t('%title is part of a book outline, and has associated child pages. If you proceed with deletion, the child pages will be relocated automatically.', array('%title' => $node->title)) . '</p>',
+ '#markup' => '<p>' . t('%title is part of a book outline, and has associated child pages. If you proceed with deletion, the child pages will be relocated automatically.', array('%title' => $node->title[FIELD_LANGUAGE_NONE][0]['value'])) . '</p>',
'#weight' => -10,
);
}
@@ -1103,7 +1103,7 @@ function book_node_export($node, $children = '') {
*/
function template_preprocess_book_node_export_html(&$variables) {
$variables['depth'] = $variables['node']->book['depth'];
- $variables['title'] = check_plain($variables['node']->title);
+ $variables['title'] = check_plain($variables['node']->title[FIELD_LANGUAGE_NONE][0]['value']);
$variables['content'] = $variables['node']->rendered;
}
diff --git a/modules/book/book.pages.inc b/modules/book/book.pages.inc
index 206f61b79..0162fa69e 100644
--- a/modules/book/book.pages.inc
+++ b/modules/book/book.pages.inc
@@ -79,7 +79,7 @@ function book_export_html($nid) {
$contents = book_export_traverse($tree, 'book_node_export');
}
- return theme('book_export_html', array('title' => $node->title, 'contents' => $contents, 'depth' => $node->book['depth']));
+ return theme('book_export_html', array('title' => $node->title[FIELD_LANGUAGE_NONE][0]['value'], 'contents' => $contents, 'depth' => $node->book['depth']));
}
else {
drupal_access_denied();
@@ -90,7 +90,7 @@ function book_export_html($nid) {
* Menu callback; show the outline form for a single node.
*/
function book_outline($node) {
- drupal_set_title($node->title);
+ drupal_set_title($node->title[FIELD_LANGUAGE_NONE][0]['value']);
return drupal_get_form('book_outline_form', $node);
}
@@ -188,7 +188,7 @@ function book_outline_form_submit($form, &$form_state) {
*/
function book_remove_form($form, &$form_state, $node) {
$form['#node'] = $node;
- $title = array('%title' => $node->title);
+ $title = array('%title' => $node->title[FIELD_LANGUAGE_NONE][0]['value']);
if ($node->book['has_children']) {
$description = t('%title has associated child pages, which will be relocated automatically to maintain their connection to the book. To recreate the hierarchy (as it was before removing this page), %title may be added again using the Outline tab, and each of its former child pages will need to be relocated manually.', $title);
diff --git a/modules/book/book.test b/modules/book/book.test
index e382f1d99..335fa4166 100644
--- a/modules/book/book.test
+++ b/modules/book/book.test
@@ -110,7 +110,7 @@ class BookTestCase extends DrupalWebTestCase {
// Check previous, up, and next links.
if ($previous) {
- $this->assertRaw(l('‹ ' . $previous->title, 'node/' . $previous->nid, array('attributes' => array('class' => array('page-previous'), 'title' => t('Go to previous page')))), t('Previous page link found.'));
+ $this->assertRaw(l('‹ ' . $previous->title[FIELD_LANGUAGE_NONE][0]['value'], 'node/' . $previous->nid, array('attributes' => array('class' => array('page-previous'), 'title' => t('Go to previous page')))), t('Previous page link found.'));
}
if ($up) {
@@ -118,7 +118,7 @@ class BookTestCase extends DrupalWebTestCase {
}
if ($next) {
- $this->assertRaw(l($next->title . ' ›', 'node/' . $next->nid, array('attributes' => array('class' => array('page-next'), 'title' => t('Go to next page')))), t('Next page link found.'));
+ $this->assertRaw(l($next->title[FIELD_LANGUAGE_NONE][0]['value'] . ' ›', 'node/' . $next->nid, array('attributes' => array('class' => array('page-next'), 'title' => t('Go to next page')))), t('Next page link found.'));
}
// Compute the expected breadcrumb.
@@ -140,7 +140,7 @@ class BookTestCase extends DrupalWebTestCase {
// Check printer friendly version.
$this->drupalGet('book/export/html/' . $node->nid);
- $this->assertText($node->title, t('Printer friendly title found.'));
+ $this->assertText($node->title[FIELD_LANGUAGE_NONE][0]['value'], t('Printer friendly title found.'));
$this->assertRaw(check_markup($node->body[FIELD_LANGUAGE_NONE][0]['value'], $node->body[FIELD_LANGUAGE_NONE][0]['format']), t('Printer friendly body found.'));
$number++;
@@ -154,7 +154,7 @@ class BookTestCase extends DrupalWebTestCase {
function generateOutlinePattern($nodes) {
$outline = '';
foreach ($nodes as $node) {
- $outline .= '(node\/' . $node->nid . ')(.*?)(' . $node->title . ')(.*?)';
+ $outline .= '(node\/' . $node->nid . ')(.*?)(' . $node->title[FIELD_LANGUAGE_NONE][0]['value'] . ')(.*?)';
}
return '/<div id="book-navigation-' . $this->book->nid . '"(.*?)<ul(.*?)' . $outline . '<\/ul>/s';
@@ -172,8 +172,8 @@ class BookTestCase extends DrupalWebTestCase {
static $number = 0; // Used to ensure that when sorted nodes stay in same order.
$edit = array();
- $edit['title'] = $number . ' - SimpleTest test node ' . $this->randomName(10);
$langcode = FIELD_LANGUAGE_NONE;
+ $edit["title[$langcode][0][value]"] = $number . ' - SimpleTest test node ' . $this->randomName(10);
$edit["body[$langcode][0][value]"] = 'SimpleTest test body ' . $this->randomName(32) . ' ' . $this->randomName(32);
$edit['book[bid]'] = $book_nid;
@@ -188,7 +188,7 @@ class BookTestCase extends DrupalWebTestCase {
}
// Check to make sure the book node was created.
- $node = $this->drupalGetNodeByTitle($edit['title']);
+ $node = $this->drupalGetNodeByTitle($edit["title[$langcode][0][value]"]);
$this->assertNotNull(($node === FALSE ? NULL : $node), t('Book node found in database.'));
$number++;
diff --git a/modules/comment/comment.pages.inc b/modules/comment/comment.pages.inc
index 3ed612c01..b428a7f6b 100644
--- a/modules/comment/comment.pages.inc
+++ b/modules/comment/comment.pages.inc
@@ -29,7 +29,7 @@
*/
function comment_reply($node, $pid = NULL) {
// Set the breadcrumb trail.
- drupal_set_breadcrumb(array(l(t('Home'), NULL), l($node->title, 'node/' . $node->nid)));
+ drupal_set_breadcrumb(array(l(t('Home'), NULL), l($node->title[FIELD_LANGUAGE_NONE][0]['value'], 'node/' . $node->nid)));
$op = isset($_POST['op']) ? $_POST['op'] : '';
$build = array();
diff --git a/modules/comment/comment.tokens.inc b/modules/comment/comment.tokens.inc
index 8ca74fa70..896ab0e7b 100644
--- a/modules/comment/comment.tokens.inc
+++ b/modules/comment/comment.tokens.inc
@@ -209,7 +209,8 @@ function comment_tokens($type, $tokens, array $data = array(), array $options =
case 'node':
$node = node_load($comment->nid);
- $replacements[$original] = $sanitize ? filter_xss($node->title) : $node->title;
+ $title = $node->title[FIELD_LANGUAGE_NONE][0]['value'];
+ $replacements[$original] = $sanitize ? filter_xss($title) : $title;
break;
}
}
diff --git a/modules/dblog/dblog.test b/modules/dblog/dblog.test
index 8e8caa4a3..c86d45e9a 100644
--- a/modules/dblog/dblog.test
+++ b/modules/dblog/dblog.test
@@ -266,7 +266,8 @@ class DBLogTestCase extends DrupalWebTestCase {
// Create node using form to generate add content event (which is not triggered by drupalCreateNode).
$edit = $this->getContent($type);
- $title = $edit['title'];
+ $langcode = FIELD_LANGUAGE_NONE;
+ $title = $edit["title[$langcode][0][value]"];
$this->drupalPost('node/add/' . $type, $edit, t('Save'));
$this->assertResponse(200);
// Retrieve node object.
@@ -320,19 +321,19 @@ class DBLogTestCase extends DrupalWebTestCase {
* @return array Content.
*/
private function getContent($type) {
+ $langcode = FIELD_LANGUAGE_NONE;
switch ($type) {
case 'poll':
$content = array(
- 'title' => $this->randomName(8),
+ "title[$langcode][0][value]" => $this->randomName(8),
'choice[new:0][chtext]' => $this->randomName(32),
'choice[new:1][chtext]' => $this->randomName(32),
);
break;
default:
- $langcode = FIELD_LANGUAGE_NONE;
$content = array(
- 'title' => $this->randomName(8),
+ "title[$langcode][0][value]" => $this->randomName(8),
"body[$langcode][0][value]" => $this->randomName(32),
);
break;
diff --git a/modules/file/tests/file.test b/modules/file/tests/file.test
index f37050795..2a39b8b19 100644
--- a/modules/file/tests/file.test
+++ b/modules/file/tests/file.test
@@ -87,8 +87,9 @@ class FileFieldTestCase extends DrupalWebTestCase {
* Upload a file to a node.
*/
function uploadNodeFile($file, $field_name, $nid_or_type, $new_revision = TRUE) {
+ $langcode = FIELD_LANGUAGE_NONE;
$edit = array(
- 'title' => $this->randomName(),
+ "title[$langcode][0][value]" => $this->randomName(),
'revision' => (string) (int) $new_revision,
);
@@ -344,7 +345,8 @@ class FileFieldValidateTestCase extends FileFieldTestCase {
$test_file = $this->getTestFile('text');
// Try to post a new node without uploading a file.
- $edit = array('title' => $this->randomName());
+ $langcode = FIELD_LANGUAGE_NONE;
+ $edit = array("title[$langcode][0][value]" => $this->randomName());
$this->drupalPost('node/add/' . $type_name, $edit, t('Save'));
$this->assertRaw(t('!title field is required.', array('!title' => $instance['label'])), t('Node save failed when required file field was empty.'));
@@ -361,7 +363,7 @@ class FileFieldValidateTestCase extends FileFieldTestCase {
$this->createFileField($field_name, $type_name, array('cardinality' => FIELD_CARDINALITY_UNLIMITED), array('required' => '1'));
// Try to post a new node without uploading a file in the multivalue field.
- $edit = array('title' => $this->randomName());
+ $edit = array("title[$langcode][0][value]" => $this->randomName());
$this->drupalPost('node/add/' . $type_name, $edit, t('Save'));
$this->assertRaw(t('!title field is required.', array('!title' => $instance['label'])), t('Node save failed when required multiple value file field was empty.'));
diff --git a/modules/filter/filter.test b/modules/filter/filter.test
index 9b7837385..20422fe26 100644
--- a/modules/filter/filter.test
+++ b/modules/filter/filter.test
@@ -274,14 +274,14 @@ class FilterAdminTestCase extends DrupalWebTestCase {
$text = $body . '<random>' . $extra_text . '</random>';
$edit = array();
- $edit['title'] = $this->randomName();
$langcode = FIELD_LANGUAGE_NONE;
+ $edit["title[$langcode][0][value]"] = $this->randomName();
$edit["body[$langcode][0][value]"] = $text;
$edit["body[$langcode][0][value_format]"] = $filtered;
$this->drupalPost('node/add/page', $edit, t('Save'));
- $this->assertRaw(t('Page %title has been created.', array('%title' => $edit['title'])), t('Filtered node created.'));
+ $this->assertRaw(t('Page %title has been created.', array('%title' => $edit["title[$langcode][0][value]"])), t('Filtered node created.'));
- $node = $this->drupalGetNodeByTitle($edit['title']);
+ $node = $this->drupalGetNodeByTitle($edit["title[$langcode][0][value]"]);
$this->assertTrue($node, t('Node found in database.'));
$this->drupalGet('node/' . $node->nid);
diff --git a/modules/forum/forum.module b/modules/forum/forum.module
index 1d494b2eb..95c0337e6 100644
--- a/modules/forum/forum.module
+++ b/modules/forum/forum.module
@@ -431,7 +431,7 @@ function forum_field_attach_pre_insert($obj_type, $object, $skip_fields) {
foreach ($language as $delta) {
$query->values(array(
'nid' => $object->nid,
- 'title' => $object->title,
+ 'title' => $object->title[FIELD_LANGUAGE_NONE][0]['value'],
'tid' => $delta['value'],
'sticky' => $object->sticky,
'created' => $object->created,
@@ -606,8 +606,7 @@ function forum_block_view_pre_render($elements) {
*/
function forum_form($node, $form_state) {
$type = node_type_get_type($node);
- $form['title'] = array('#type' => 'textfield', '#title' => check_plain($type->title_label), '#default_value' => !empty($node->title) ? $node->title : '', '#required' => TRUE, '#weight' => -5);
-
+
if (!empty($node->nid)) {
$forum_terms = $node->taxonomy_forums;
// If editing, give option to leave shadows
diff --git a/modules/forum/forum.test b/modules/forum/forum.test
index 4496949b9..28995361f 100644
--- a/modules/forum/forum.test
+++ b/modules/forum/forum.test
@@ -248,7 +248,7 @@ class ForumTestCase extends DrupalWebTestCase {
$langcode = FIELD_LANGUAGE_NONE;
$edit = array(
- 'title' => $title,
+ "title[$langcode][0][value]" => $title,
"body[$langcode][0][value]" => $body,
"taxonomy_forums[$langcode][value]" => $tid,
);
@@ -323,27 +323,27 @@ class ForumTestCase extends DrupalWebTestCase {
// View forum node.
$this->drupalGet('node/' . $node->nid);
$this->assertResponse(200);
- $this->assertTitle($node->title . ' | Drupal', t('Forum node was displayed'));
+ $this->assertTitle($node->title[FIELD_LANGUAGE_NONE][0]['value'] . ' | Drupal', t('Forum node was displayed'));
$this->assertText(t('Home ' . $crumb . ' Forums ' . $crumb . ' @container ' . $crumb . ' @forum', array('@container' => $this->container['name'], '@forum' => $this->forum['name'])), t('Breadcrumbs were displayed'));
// View forum edit node.
$this->drupalGet('node/' . $node->nid . '/edit');
$this->assertResponse($response);
if ($response == 200) {
- $this->assertTitle('Edit Forum topic ' . $node->title . ' | Drupal', t('Forum edit node was displayed'));
+ $this->assertTitle('Edit Forum topic ' . $node->title[FIELD_LANGUAGE_NONE][0]['value'] . ' | Drupal', t('Forum edit node was displayed'));
}
if ($response == 200) {
// Edit forum node (including moving it to another forum).
$edit = array();
- $edit['title'] = 'node/' . $node->nid;
$langcode = FIELD_LANGUAGE_NONE;
+ $edit["title[$langcode][0][value]"] = 'node/' . $node->nid;
$edit["body[$langcode][0][value]"] = $this->randomName(256);
// Assume the topic is initially associated with $forum.
$edit["taxonomy_forums[$langcode][value]"] = $this->root_forum['tid'];
$edit['shadow'] = TRUE;
$this->drupalPost('node/' . $node->nid . '/edit', $edit, t('Save'));
- $this->assertRaw(t('Forum topic %title has been updated.', array('%title' => $edit['title'])), t('Forum node was edited'));
+ $this->assertRaw(t('Forum topic %title has been updated.', array('%title' => $edit["title[$langcode][0][value]"])), t('Forum node was edited'));
// Verify topic was moved to a different forum.
$forum_tid = db_query("SELECT tid FROM {forum} WHERE nid = :nid AND vid = :vid", array(
@@ -355,7 +355,7 @@ class ForumTestCase extends DrupalWebTestCase {
// Delete forum node.
$this->drupalPost('node/' . $node->nid . '/delete', array(), t('Delete'));
$this->assertResponse($response);
- $this->assertRaw(t('Forum topic %title has been deleted.', array('%title' => $edit['title'])), t('Forum node was deleted'));
+ $this->assertRaw(t('Forum topic %title has been deleted.', array('%title' => $edit["title[$langcode][0][value]"])), t('Forum node was deleted'));
}
}
diff --git a/modules/locale/locale.test b/modules/locale/locale.test
index fc598e296..b03b85d0d 100644
--- a/modules/locale/locale.test
+++ b/modules/locale/locale.test
@@ -1285,11 +1285,11 @@ class LocalePathFunctionalTest extends DrupalWebTestCase {
// Confirm English language path alias works.
$this->drupalGet($english_path);
- $this->assertText($node->title, t('English alias works.'));
+ $this->assertText($node->title[FIELD_LANGUAGE_NONE][0]['value'], t('English alias works.'));
// Confirm custom language path alias works.
$this->drupalGet($prefix . '/' . $custom_language_path);
- $this->assertText($node->title, t('Custom language alias works.'));
+ $this->assertText($node->title[FIELD_LANGUAGE_NONE][0]['value'], t('Custom language alias works.'));
$this->drupalLogout();
}
@@ -1395,7 +1395,7 @@ class LocaleContentFunctionalTest extends DrupalWebTestCase {
$node_body = $this->randomName();
$edit = array(
'type' => 'page',
- 'title' => $node_title,
+ 'title' => array(FIELD_LANGUAGE_NONE => array(array('value' => $node_title))),
'body' => array(FIELD_LANGUAGE_NONE => array(array('value' => $node_body))),
'language' => $langcode,
);
diff --git a/modules/menu/menu.module b/modules/menu/menu.module
index ca77e5687..17967e26c 100644
--- a/modules/menu/menu.module
+++ b/modules/menu/menu.module
@@ -399,7 +399,7 @@ function menu_node_insert($node) {
$item['link_title'] = trim($item['link_title']);
$item['link_path'] = "node/$node->nid";
if (!$item['customized']) {
- $item['options']['attributes']['title'] = trim($node->title);
+ $item['options']['attributes']['title'] = trim($node->title[FIELD_LANGUAGE_NONE][0]['value']);
}
if (!menu_link_save($item)) {
drupal_set_message(t('There was an error saving the menu link.'), 'error');
@@ -421,7 +421,7 @@ function menu_node_update($node) {
$item['link_title'] = trim($item['link_title']);
$item['link_path'] = "node/$node->nid";
if (!$item['customized']) {
- $item['options']['attributes']['title'] = trim($node->title);
+ $item['options']['attributes']['title'] = trim($node->title[FIELD_LANGUAGE_NONE][0]['value']);
}
if (!menu_link_save($item)) {
drupal_set_message(t('There was an error saving the menu link.'), 'error');
diff --git a/modules/menu/menu.test b/modules/menu/menu.test
index 796b90f57..38a44539c 100644
--- a/modules/menu/menu.test
+++ b/modules/menu/menu.test
@@ -315,7 +315,7 @@ class MenuTestCase extends DrupalWebTestCase {
// Verify menu link link.
$this->clickLink($title);
- $title = $parent_node->title;
+ $title = $parent_node->title[FIELD_LANGUAGE_NONE][0]['value'];
$this->assertTitle(t("@title | Drupal", array('@title' => $title)), t('Parent menu link link target was correct'));
}
@@ -325,7 +325,7 @@ class MenuTestCase extends DrupalWebTestCase {
// Verify menu link link.
$this->clickLink($title);
- $title = $item_node->title;
+ $title = $item_node->title[FIELD_LANGUAGE_NONE][0]['value'];
$this->assertTitle(t("@title | Drupal", array('@title' => $title)), t('Menu link link target was correct'));
}
diff --git a/modules/node/node.admin.inc b/modules/node/node.admin.inc
index 6563f1b4a..d9d3bec6e 100644
--- a/modules/node/node.admin.inc
+++ b/modules/node/node.admin.inc
@@ -339,7 +339,7 @@ function _node_mass_update_batch_process($nodes, $updates, &$context) {
$node = _node_mass_update_helper($nid, $updates);
// Store result for post-processing in the finished callback.
- $context['results'][] = l($node->title, 'node/' . $node->nid);
+ $context['results'][] = l($node->title[FIELD_LANGUAGE_NONE][0]['value'], 'node/' . $node->nid);
// Update our progress information.
$context['sandbox']['progress']++;
diff --git a/modules/node/node.install b/modules/node/node.install
index 947757605..7a4e156eb 100644
--- a/modules/node/node.install
+++ b/modules/node/node.install
@@ -438,9 +438,9 @@ function node_update_7006(&$context) {
if (!isset($context['total'])) {
// Initial invocation.
- // Re-save node types to create body field instances.
+ // Re-save node types to create title and body field instances.
foreach ($node_types as $type => $info) {
- if ($info->has_body) {
+ if ($info->has_title || $info->has_body) {
node_type_save($info);
}
}
@@ -485,6 +485,7 @@ function node_update_7006(&$context) {
'vid' => $revision->vid,
'type' => $revision->type,
);
+ $node->title[FIELD_LANGUAGE_NONE][0]['value'] = $revision->title;
if (!empty($revision->teaser) && $revision->teaser != text_summary($revision->body)) {
$node->body[FIELD_LANGUAGE_NONE][0]['summary'] = $revision->teaser;
}
diff --git a/modules/node/node.module b/modules/node/node.module
index 2e6a3800c..b4869de54 100644
--- a/modules/node/node.module
+++ b/modules/node/node.module
@@ -234,25 +234,6 @@ function node_field_build_modes($obj_type) {
}
/**
- * Implement hook_field_extra_fields().
- */
-function node_field_extra_fields($bundle) {
- $extra = array();
-
- if ($type = node_type_get_type($bundle)) {
- if ($type->has_title) {
- $extra['title'] = array(
- 'label' => $type->title_label,
- 'description' => t('Node module element.'),
- 'weight' => -5,
- );
- }
- }
-
- return $extra;
-}
-
-/**
* Gather a listing of links to nodes.
*
* @param $result
@@ -588,6 +569,50 @@ function node_configure_fields($type) {
field_delete_instance($instance);
}
+ if ($type->has_title) {
+ // Add the title field if not present.
+ $field = field_info_field('title');
+ $instance = field_info_instance('title', $type->type);
+
+ if (empty($field)) {
+ $field = array(
+ 'field_name' => 'title',
+ 'type' => 'text',
+ );
+ $field = field_create_field($field);
+ }
+ if (empty($instance)) {
+ $weight = -5;
+ $instance = array(
+ 'field_name' => 'title',
+ 'bundle' => $type->type,
+ 'label' => $type->title_label,
+ 'widget_type' => 'text',
+ 'widget' => array(
+ 'weight' => $weight,
+ ),
+ 'required' => TRUE,
+ 'locked' => TRUE,
+ 'display' => array(
+ 'full' => array(
+ 'label' => 'hidden',
+ 'type' => 'text_default',
+ 'weight' => $weight,
+ ),
+ 'teaser' => array(
+ 'label' => 'hidden',
+ 'type' => 'text_default',
+ 'weight' => $weight,
+ ),
+ ),
+ );
+ field_create_instance($instance);
+ }
+ else {
+ $instance['label'] = $type->title_label;
+ field_update_instance($instance);
+ }
+ }
}
/**
@@ -905,6 +930,14 @@ function node_save($node) {
$node->timestamp = REQUEST_TIME;
$update_node = TRUE;
+ // When converting the title property to fields we preserved the {node}.title
+ // db column for performance, setting the default language value into this
+ // column. After this we restore the field data structure to the previous node
+ // title field.
+ $title_field = $node->title;
+ $langcode = FIELD_LANGUAGE_NONE;
+ $node->title = $title_field[$langcode][0]['value'];
+
// Generate the node table query and the node_revisions table query.
if ($node->is_new) {
drupal_write_record('node', $node);
@@ -929,6 +962,9 @@ function node_save($node) {
->execute();
}
+ // Restore the title field data structure after db storage.
+ $node->title = $title_field;
+
// Call the node specific callback (if any). This can be
// node_invoke($node, 'insert') or
// node_invoke($node, 'update').
@@ -1121,7 +1157,7 @@ function node_build_content($node, $build_mode = 'full') {
$links['node_readmore'] = array(
'title' => t('Read more'),
'href' => 'node/' . $node->nid,
- 'attributes' => array('rel' => 'tag', 'title' => strip_tags($node->title))
+ 'attributes' => array('rel' => 'tag', 'title' => strip_tags($node->title[FIELD_LANGUAGE_NONE][0]['value']))
);
}
$node->content['links']['node'] = array(
@@ -1195,7 +1231,7 @@ function node_language_provider($languages) {
*/
function node_show($node, $message = FALSE) {
if ($message) {
- drupal_set_title(t('Revision of %title from %date', array('%title' => $node->title, '%date' => format_date($node->revision_timestamp))), PASS_THROUGH);
+ drupal_set_title(t('Revision of %title from %date', array('%title' => $node->title[FIELD_LANGUAGE_NONE][0]['value'], '%date' => format_date($node->revision_timestamp))), PASS_THROUGH);
}
// Update the history table, stating that this user viewed this node.
@@ -1229,7 +1265,7 @@ function template_preprocess_node(&$variables) {
$variables['date'] = format_date($node->created);
$variables['name'] = theme('username', array('account' => $node));
$variables['node_url'] = url('node/' . $node->nid);
- $variables['title'] = check_plain($node->title);
+ $variables['node_title'] = check_plain($node->title[FIELD_LANGUAGE_NONE][0]['value']);
$variables['page'] = (bool)menu_get_object();
if (!empty($node->in_preview)) {
@@ -1247,6 +1283,10 @@ function template_preprocess_node(&$variables) {
// Make the field variables available with the appropriate language.
field_attach_preprocess('node', $node, $variables['content'], $variables);
+ if (isset($variables['content']['title'])) {
+ unset($variables['content']['title']);
+ }
+
// Display post information only on certain node types.
if (variable_get('node_submitted_' . $node->type, TRUE)) {
$variables['display_submitted'] = TRUE;
@@ -1475,7 +1515,7 @@ function node_search_execute($keys = NULL) {
$results[] = array(
'link' => url('node/' . $item->sid, array('absolute' => TRUE)),
'type' => check_plain(node_type_get_name($node)),
- 'title' => $node->title,
+ 'title' => $node->title[FIELD_LANGUAGE_NONE][0]['value'],
'user' => theme('username', array('account' => $node)),
'date' => $node->changed,
'node' => $node,
@@ -1758,8 +1798,6 @@ function node_menu() {
);
}
$items['node/%node'] = array(
- 'title callback' => 'node_page_title',
- 'title arguments' => array(1),
'page callback' => 'node_page_view',
'page arguments' => array(1),
'access callback' => 'node_access',
@@ -1959,7 +1997,7 @@ function node_feed($nids = FALSE, $channel = array()) {
$item_text .= drupal_render($node->content) . $links;
}
- $items .= format_rss_item($node->title, $node->link, $item_text, $node->rss_elements);
+ $items .= format_rss_item($node->title[FIELD_LANGUAGE_NONE][0]['value'], $node->link, $item_text, $node->rss_elements);
}
$channel_defaults = array(
@@ -2060,8 +2098,11 @@ function node_page_default() {
* Menu callback; view a single node.
*/
function node_page_view($node) {
- drupal_set_title($node->title);
- return node_show($node);
+ $return = node_show($node);
+ if (isset($return['nodes'][$node->nid]['title'])) {
+ drupal_set_title($return['nodes'][$node->nid]['title']['items'][0]['#item']['value']);
+ }
+ return $return;
}
/**
@@ -2094,7 +2135,7 @@ function _node_index_node($node) {
node_build_content($node, 'search_index');
$node->rendered = drupal_render($node->content);
- $text = '<h1>' . check_plain($node->title) . '</h1>' . $node->rendered;
+ $text = '<h1>' . check_plain($node->title[FIELD_LANGUAGE_NONE][0]['value']) . '</h1>' . $node->rendered;
// Fetch extra data normally not visible
$extra = module_invoke_all('node_update_index', $node);
@@ -2819,20 +2860,10 @@ function _node_access_rebuild_batch_finished($success, $results, $operations) {
* Implement hook_form().
*/
function node_content_form($node, $form_state) {
- $type = node_type_get_type($node);
-
- if ($type->has_title) {
- $form['title'] = array(
- '#type' => 'textfield',
- '#title' => check_plain($type->title_label),
- '#required' => TRUE,
- '#default_value' => $node->title,
- '#maxlength' => 255,
- '#weight' => -5,
- );
- }
-
- return $form;
+ // It is impossible to define a content type without implementing hook_form()
+ // so simply return an empty array().
+ // @todo: remove this requirement.
+ return array();
}
/**
@@ -2948,7 +2979,7 @@ function node_action_info() {
*/
function node_publish_action($node, $context = array()) {
$node->status = NODE_PUBLISHED;
- watchdog('action', 'Set @type %title to published.', array('@type' => node_type_get_name($node), '%title' => $node->title));
+ watchdog('action', 'Set @type %title to published.', array('@type' => node_type_get_name($node), '%title' => $node->title[FIELD_LANGUAGE_NONE][0]['value']));
}
/**
@@ -2957,7 +2988,7 @@ function node_publish_action($node, $context = array()) {
*/
function node_unpublish_action($node, $context = array()) {
$node->status = NODE_NOT_PUBLISHED;
- watchdog('action', 'Set @type %title to unpublished.', array('@type' => node_type_get_name($node), '%title' => $node->title));
+ watchdog('action', 'Set @type %title to unpublished.', array('@type' => node_type_get_name($node), '%title' => $node->title[FIELD_LANGUAGE_NONE][0]['value']));
}
/**
@@ -2966,7 +2997,7 @@ function node_unpublish_action($node, $context = array()) {
*/
function node_make_sticky_action($node, $context = array()) {
$node->sticky = NODE_STICKY;
- watchdog('action', 'Set @type %title to sticky.', array('@type' => node_type_get_name($node), '%title' => $node->title));
+ watchdog('action', 'Set @type %title to sticky.', array('@type' => node_type_get_name($node), '%title' => $node->title[FIELD_LANGUAGE_NONE][0]['value']));
}
/**
@@ -2975,7 +3006,7 @@ function node_make_sticky_action($node, $context = array()) {
*/
function node_make_unsticky_action($node, $context = array()) {
$node->sticky = NODE_NOT_STICKY;
- watchdog('action', 'Set @type %title to unsticky.', array('@type' => node_type_get_name($node), '%title' => $node->title));
+ watchdog('action', 'Set @type %title to unsticky.', array('@type' => node_type_get_name($node), '%title' => $node->title[FIELD_LANGUAGE_NONE][0]['value']));
}
/**
@@ -2984,7 +3015,7 @@ function node_make_unsticky_action($node, $context = array()) {
*/
function node_promote_action($node, $context = array()) {
$node->promote = NODE_PROMOTED;
- watchdog('action', 'Promoted @type %title to front page.', array('@type' => node_type_get_name($node), '%title' => $node->title));
+ watchdog('action', 'Promoted @type %title to front page.', array('@type' => node_type_get_name($node), '%title' => $node->title[FIELD_LANGUAGE_NONE][0]['value']));
}
/**
@@ -2993,7 +3024,7 @@ function node_promote_action($node, $context = array()) {
*/
function node_unpromote_action($node, $context = array()) {
$node->promote = NODE_NOT_PROMOTED;
- watchdog('action', 'Removed @type %title from front page.', array('@type' => node_type_get_name($node), '%title' => $node->title));
+ watchdog('action', 'Removed @type %title from front page.', array('@type' => node_type_get_name($node), '%title' => $node->title[FIELD_LANGUAGE_NONE][0]['value']));
}
/**
@@ -3002,7 +3033,7 @@ function node_unpromote_action($node, $context = array()) {
*/
function node_save_action($node) {
node_save($node);
- watchdog('action', 'Saved @type %title', array('@type' => node_type_get_name($node), '%title' => $node->title));
+ watchdog('action', 'Saved @type %title', array('@type' => node_type_get_name($node), '%title' => $node->title[FIELD_LANGUAGE_NONE][0]['value']));
}
/**
@@ -3012,7 +3043,7 @@ function node_save_action($node) {
function node_assign_owner_action($node, $context) {
$node->uid = $context['owner_uid'];
$owner_name = db_query("SELECT name FROM {users} WHERE uid = :uid", array(':uid' => $context['owner_uid']))->fetchField();
- watchdog('action', 'Changed owner of @type %title to uid %name.', array('@type' => node_type_get_type($node), '%title' => $node->title, '%name' => $owner_name));
+ watchdog('action', 'Changed owner of @type %title to uid %name.', array('@type' => node_type_get_type($node), '%title' => $node->title[FIELD_LANGUAGE_NONE][0]['value'], '%name' => $owner_name));
}
function node_assign_owner_action_form($context) {
@@ -3093,7 +3124,7 @@ function node_unpublish_by_keyword_action($node, $context) {
foreach ($context['keywords'] as $keyword) {
if (strpos(drupal_render(node_build(clone $node)), $keyword) !== FALSE || strpos($node->title, $keyword) !== FALSE) {
$node->status = NODE_NOT_PUBLISHED;
- watchdog('action', 'Set @type %title to unpublished.', array('@type' => node_type_get_name($node), '%title' => $node->title));
+ watchdog('action', 'Set @type %title to unpublished.', array('@type' => node_type_get_name($node), '%title' => $node->title[FIELD_LANGUAGE_NONE][0]['value']));
break;
}
}
@@ -3137,6 +3168,9 @@ class NodeController extends DrupalDefaultEntityController {
// object type specific callback.
$typed_nodes = array();
foreach ($nodes as $id => $object) {
+ if (isset($object->title)) {
+ $object->title = array(FIELD_LANGUAGE_NONE => array(array('value' => $object->title)));
+ }
$typed_nodes[$object->type][$id] = $object;
}
diff --git a/modules/node/node.pages.inc b/modules/node/node.pages.inc
index bd59747df..276a2dd86 100644
--- a/modules/node/node.pages.inc
+++ b/modules/node/node.pages.inc
@@ -12,7 +12,7 @@
*/
function node_page_edit($node) {
$type_name = node_type_get_name($node);
- drupal_set_title(t('<em>Edit @type</em> @title', array('@type' => $type_name, '@title' => $node->title)), PASS_THROUGH);
+ drupal_set_title(t('<em>Edit @type</em> @title', array('@type' => $type_name, '@title' => $node->title[FIELD_LANGUAGE_NONE][0]['value'])), PASS_THROUGH);
return drupal_get_form($node->type . '_node_form', $node);
}
@@ -150,9 +150,6 @@ function node_form($form, &$form_state, $node) {
if ($extra = node_invoke($node, 'form', $form_state)) {
$form = array_merge_recursive($form, $extra);
}
- if (!isset($form['title']['#weight'])) {
- $form['title']['#weight'] = -5;
- }
$form['#node'] = $node;
@@ -414,8 +411,8 @@ function node_form_submit($form, &$form_state) {
$insert = empty($node->nid);
node_save($node);
$node_link = l(t('view'), 'node/' . $node->nid);
- $watchdog_args = array('@type' => $node->type, '%title' => $node->title);
- $t_args = array('@type' => node_type_get_name($node), '%title' => $node->title);
+ $watchdog_args = array('@type' => $node->type, '%title' => $node->title[FIELD_LANGUAGE_NONE][0]['value']);
+ $t_args = array('@type' => node_type_get_name($node), '%title' => $node->title[FIELD_LANGUAGE_NONE][0]['value']);
if ($insert) {
watchdog('content', '@type: added %title.', $watchdog_args, WATCHDOG_NOTICE, $node_link);
@@ -464,7 +461,7 @@ function node_delete_confirm($form, &$form_state, $node) {
);
return confirm_form($form,
- t('Are you sure you want to delete %title?', array('%title' => $node->title)),
+ t('Are you sure you want to delete %title?', array('%title' => $node->title[FIELD_LANGUAGE_NONE][0]['value'])),
isset($_GET['destination']) ? $_GET['destination'] : 'node/' . $node->nid,
t('This action cannot be undone.'),
t('Delete'),
@@ -479,8 +476,8 @@ function node_delete_confirm_submit($form, &$form_state) {
if ($form_state['values']['confirm']) {
$node = node_load($form_state['values']['nid']);
node_delete($form_state['values']['nid']);
- watchdog('content', '@type: deleted %title.', array('@type' => $node->type, '%title' => $node->title));
- drupal_set_message(t('@type %title has been deleted.', array('@type' => node_type_get_name($node), '%title' => $node->title)));
+ watchdog('content', '@type: deleted %title.', array('@type' => $node->type, '%title' => $node->title[FIELD_LANGUAGE_NONE][0]['value']));
+ drupal_set_message(t('@type %title has been deleted.', array('@type' => node_type_get_name($node), '%title' => $node->title[FIELD_LANGUAGE_NONE][0]['value'])));
}
$form_state['redirect'] = '<front>';
@@ -490,7 +487,7 @@ function node_delete_confirm_submit($form, &$form_state) {
* Generate an overview table of older revisions of a node.
*/
function node_revision_overview($node) {
- drupal_set_title(t('Revisions for %title', array('%title' => $node->title)), PASS_THROUGH);
+ drupal_set_title(t('Revisions for %title', array('%title' => $node->title[FIELD_LANGUAGE_NONE][0]['value'])), PASS_THROUGH);
$header = array(t('Revision'), array('data' => t('Operations'), 'colspan' => 2));
@@ -552,8 +549,8 @@ function node_revision_revert_confirm_submit($form, &$form_state) {
node_save($node_revision);
- watchdog('content', '@type: reverted %title revision %revision.', array('@type' => $node_revision->type, '%title' => $node_revision->title, '%revision' => $node_revision->vid));
- drupal_set_message(t('@type %title has been reverted back to the revision from %revision-date.', array('@type' => node_type_get_name($node_revision), '%title' => $node_revision->title, '%revision-date' => format_date($node_revision->revision_timestamp))));
+ watchdog('content', '@type: reverted %title revision %revision.', array('@type' => $node_revision->type, '%title' => $node_revision->title[FIELD_LANGUAGE_NONE][0]['value'], '%revision' => $node_revision->vid));
+ drupal_set_message(t('@type %title has been reverted back to the revision from %revision-date.', array('@type' => node_type_get_name($node_revision), '%title' => $node_revision->title[FIELD_LANGUAGE_NONE][0]['value'], '%revision-date' => format_date($node_revision->revision_timestamp))));
$form_state['redirect'] = 'node/' . $node_revision->nid . '/revisions';
}
@@ -566,8 +563,8 @@ function node_revision_delete_confirm_submit($form, &$form_state) {
$node_revision = $form['#node_revision'];
node_revision_delete($node_revision->vid);
- watchdog('content', '@type: deleted %title revision %revision.', array('@type' => $node_revision->type, '%title' => $node_revision->title, '%revision' => $node_revision->vid));
- drupal_set_message(t('Revision from %revision-date of @type %title has been deleted.', array('%revision-date' => format_date($node_revision->revision_timestamp), '@type' => node_type_get_name($node_revision), '%title' => $node_revision->title)));
+ watchdog('content', '@type: deleted %title revision %revision.', array('@type' => $node_revision->type, '%title' => $node_revision->title[FIELD_LANGUAGE_NONE][0]['value'], '%revision' => $node_revision->vid));
+ drupal_set_message(t('Revision from %revision-date of @type %title has been deleted.', array('%revision-date' => format_date($node_revision->revision_timestamp), '@type' => node_type_get_name($node_revision), '%title' => $node_revision->title[FIELD_LANGUAGE_NONE][0]['value'])));
$form_state['redirect'] = 'node/' . $node_revision->nid;
if (db_query('SELECT COUNT(vid) FROM {node_revision} WHERE nid = :nid', array(':nid' => $node_revision->nid))->fetchField() > 1) {
$form_state['redirect'] .= '/revisions';
diff --git a/modules/node/node.test b/modules/node/node.test
index f1c296a76..a4f5f90e1 100644
--- a/modules/node/node.test
+++ b/modules/node/node.test
@@ -31,15 +31,15 @@ class NodeLoadMultipleUnitTest extends DrupalWebTestCase {
// Confirm that promoted nodes appear in the default node listing.
$this->drupalGet('node');
- $this->assertText($node1->title, t('Node title appears on the default listing.'));
- $this->assertText($node2->title, t('Node title appears on the default listing.'));
- $this->assertNoText($node3->title, t('Node title does not appear in the default listing.'));
- $this->assertNoText($node4->title, t('Node title does not appear in the default listing.'));
+ $this->assertText($node1->title[FIELD_LANGUAGE_NONE][0]['value'], t('Node title appears on the default listing.'));
+ $this->assertText($node2->title[FIELD_LANGUAGE_NONE][0]['value'], t('Node title appears on the default listing.'));
+ $this->assertNoText($node3->title[FIELD_LANGUAGE_NONE][0]['value'], t('Node title does not appear in the default listing.'));
+ $this->assertNoText($node4->title[FIELD_LANGUAGE_NONE][0]['value'], t('Node title does not appear in the default listing.'));
// Load nodes with only a condition. Nodes 3 and 4 will be loaded.
$nodes = node_load_multiple(NULL, array('promote' => 0));
- $this->assertEqual($node3->title, $nodes[$node3->nid]->title, t('Node was loaded.'));
- $this->assertEqual($node4->title, $nodes[$node4->nid]->title, t('Node was loaded.'));
+ $this->assertEqual($node3->title[FIELD_LANGUAGE_NONE][0]['value'], $nodes[$node3->nid]->title[FIELD_LANGUAGE_NONE][0]['value'], t('Node was loaded.'));
+ $this->assertEqual($node4->title[FIELD_LANGUAGE_NONE][0]['value'], $nodes[$node4->nid]->title[FIELD_LANGUAGE_NONE][0]['value'], t('Node was loaded.'));
$count = count($nodes);
$this->assertTrue($count == 2, t('@count nodes loaded.', array('@count' => $count)));
@@ -58,9 +58,9 @@ class NodeLoadMultipleUnitTest extends DrupalWebTestCase {
$nodes = node_load_multiple(array(1, 2, 3, 4), array('type' => 'article'));
$count = count($nodes);
$this->assertTrue($count == 3, t('@count nodes loaded', array('@count' => $count)));
- $this->assertEqual($nodes[$node1->nid]->title, $node1->title, t('Node successfully loaded.'));
- $this->assertEqual($nodes[$node2->nid]->title, $node2->title, t('Node successfully loaded.'));
- $this->assertEqual($nodes[$node3->nid]->title, $node3->title, t('Node successfully loaded.'));
+ $this->assertEqual($nodes[$node1->nid]->title[FIELD_LANGUAGE_NONE][0]['value'], $node1->title[FIELD_LANGUAGE_NONE][0]['value'], t('Node successfully loaded.'));
+ $this->assertEqual($nodes[$node2->nid]->title[FIELD_LANGUAGE_NONE][0]['value'], $node2->title[FIELD_LANGUAGE_NONE][0]['value'], t('Node successfully loaded.'));
+ $this->assertEqual($nodes[$node3->nid]->title[FIELD_LANGUAGE_NONE][0]['value'], $node3->title[FIELD_LANGUAGE_NONE][0]['value'], t('Node successfully loaded.'));
$this->assertFalse(isset($nodes[$node4->nid]));
// Now that all nodes have been loaded into the static cache, ensure that
@@ -68,16 +68,16 @@ class NodeLoadMultipleUnitTest extends DrupalWebTestCase {
$nodes = node_load_multiple(array(1, 2, 3, 4), array('type' => 'article'));
$count = count($nodes);
$this->assertTrue($count == 3, t('@count nodes loaded.', array('@count' => $count)));
- $this->assertEqual($nodes[$node1->nid]->title, $node1->title, t('Node successfully loaded'));
- $this->assertEqual($nodes[$node2->nid]->title, $node2->title, t('Node successfully loaded'));
- $this->assertEqual($nodes[$node3->nid]->title, $node3->title, t('Node successfully loaded'));
+ $this->assertEqual($nodes[$node1->nid]->title[FIELD_LANGUAGE_NONE][0]['value'], $node1->title[FIELD_LANGUAGE_NONE][0]['value'], t('Node successfully loaded'));
+ $this->assertEqual($nodes[$node2->nid]->title[FIELD_LANGUAGE_NONE][0]['value'], $node2->title[FIELD_LANGUAGE_NONE][0]['value'], t('Node successfully loaded'));
+ $this->assertEqual($nodes[$node3->nid]->title[FIELD_LANGUAGE_NONE][0]['value'], $node3->title[FIELD_LANGUAGE_NONE][0]['value'], t('Node successfully loaded'));
$this->assertFalse(isset($nodes[$node4->nid]), t('Node was not loaded'));
// Load nodes by nid, where type = article and promote = 0.
$nodes = node_load_multiple(array(1, 2, 3, 4), array('type' => 'article', 'promote' => 0));
$count = count($nodes);
$this->assertTrue($count == 1, t('@count node loaded', array('@count' => $count)));
- $this->assertEqual($nodes[$node3->nid]->title, $node3->title, t('Node successfully loaded.'));
+ $this->assertEqual($nodes[$node3->nid]->title[FIELD_LANGUAGE_NONE][0]['value'], $node3->title[FIELD_LANGUAGE_NONE][0]['value'], t('Node successfully loaded.'));
}
}
@@ -152,7 +152,7 @@ class NodeRevisionsTestCase extends DrupalWebTestCase {
// Confirm that revisions revert properly.
$this->drupalPost("node/$node->nid/revisions/{$nodes[1]->vid}/revert", array(), t('Revert'));
$this->assertRaw(t('@type %title has been reverted back to the revision from %revision-date.',
- array('@type' => 'Page', '%title' => $nodes[1]->title,
+ array('@type' => 'Page', '%title' => $nodes[1]->title[FIELD_LANGUAGE_NONE][0]['value'],
'%revision-date' => format_date($nodes[1]->revision_timestamp))), t('Revision reverted.'));
$reverted_node = node_load($node->nid);
$this->assertTrue(($nodes[1]->body[FIELD_LANGUAGE_NONE][0]['value'] == $reverted_node->body[FIELD_LANGUAGE_NONE][0]['value']), t('Node reverted correctly.'));
@@ -161,7 +161,7 @@ class NodeRevisionsTestCase extends DrupalWebTestCase {
$this->drupalPost("node/$node->nid/revisions/{$nodes[1]->vid}/delete", array(), t('Delete'));
$this->assertRaw(t('Revision from %revision-date of @type %title has been deleted.',
array('%revision-date' => format_date($nodes[1]->revision_timestamp),
- '@type' => 'Page', '%title' => $nodes[1]->title)), t('Revision deleted.'));
+ '@type' => 'Page', '%title' => $nodes[1]->title[FIELD_LANGUAGE_NONE][0]['value'])), t('Revision deleted.'));
$this->assertTrue(db_query('SELECT COUNT(vid) FROM {node_revision} WHERE nid = :nid and vid = :vid', array(':nid' => $node->nid, ':vid' => $nodes[1]->vid))->fetchField() == 0, t('Revision not found.'));
}
}
@@ -187,15 +187,16 @@ class PageEditTestCase extends DrupalWebTestCase {
*/
function testPageEdit() {
$langcode = FIELD_LANGUAGE_NONE;
+ $title_key = "title[$langcode][0][value]";
$body_key = "body[$langcode][0][value]";
// Create node to edit.
$edit = array();
- $edit['title'] = $this->randomName(8);
+ $edit[$title_key] = $this->randomName(8);
$edit[$body_key] = $this->randomName(16);
$this->drupalPost('node/add/page', $edit, t('Save'));
// Check that the node exists in the database.
- $node = $this->drupalGetNodeByTitle($edit['title']);
+ $node = $this->drupalGetNodeByTitle($edit[$title_key]);
$this->assertTrue($node, t('Node found in database.'));
// Check that "edit" link points to correct page.
@@ -206,18 +207,18 @@ class PageEditTestCase extends DrupalWebTestCase {
// Check that the title and body fields are displayed with the correct values.
$this->assertLink(t('Edit'), 0, t('Edit tab found.'));
- $this->assertFieldByName('title', $edit['title'], t('Title field displayed.'));
+ $this->assertFieldByName($title_key, $edit[$title_key], t('Title field displayed.'));
$this->assertFieldByName($body_key, $edit[$body_key], t('Body field displayed.'));
// Edit the content of the node.
$edit = array();
- $edit['title'] = $this->randomName(8);
+ $edit[$title_key] = $this->randomName(8);
$edit[$body_key] = $this->randomName(16);
// Stay on the current page, without reloading.
$this->drupalPost(NULL, $edit, t('Save'));
// Check that the title and body fields are displayed with the updated values.
- $this->assertText($edit['title'], t('Title displayed.'));
+ $this->assertText($edit[$title_key], t('Title displayed.'));
$this->assertText($edit[$body_key], t('Body displayed.'));
// Login as a second administrator user.
@@ -226,13 +227,13 @@ class PageEditTestCase extends DrupalWebTestCase {
// Edit the same node, creating a new revision.
$this->drupalGet("node/$node->nid/edit");
$edit = array();
- $edit['title'] = $this->randomName(8);
+ $edit[$title_key] = $this->randomName(8);
$edit[$body_key] = $this->randomName(16);
$edit['revision'] = TRUE;
$this->drupalPost(NULL, $edit, t('Save'));
// Ensure that the node revision has been created.
- $revised_node = $this->drupalGetNodeByTitle($edit['title']);
+ $revised_node = $this->drupalGetNodeByTitle($edit[$title_key]);
$this->assertNotIdentical($node->vid, $revised_node->vid, 'A new revision has been created.');
// Ensure that the node author is preserved when it was not changed in the
// edit form.
@@ -266,21 +267,22 @@ class PagePreviewTestCase extends DrupalWebTestCase {
*/
function testPagePreview() {
$langcode = FIELD_LANGUAGE_NONE;
+ $title_key = "title[$langcode][0][value]";
$body_key = "body[$langcode][0][value]";
// Fill in node creation form and preview node.
$edit = array();
- $edit['title'] = $this->randomName(8);
+ $edit[$title_key] = $this->randomName(8);
$edit[$body_key] = $this->randomName(16);
$this->drupalPost('node/add/page', $edit, t('Preview'));
// Check that the preview is displaying the title and body.
$this->assertTitle(t('Preview | Drupal'), t('Page title is preview.'));
- $this->assertText($edit['title'], t('Title displayed.'));
+ $this->assertText($edit[$title_key], t('Title displayed.'));
$this->assertText($edit[$body_key], t('Body displayed.'));
// Check that the title and body fields are displayed with the correct values.
- $this->assertFieldByName('title', $edit['title'], t('Title field displayed.'));
+ $this->assertFieldByName($title_key, $edit[$title_key], t('Title field displayed.'));
$this->assertFieldByName($body_key, $edit[$body_key], t('Body field displayed.'));
}
@@ -289,24 +291,25 @@ class PagePreviewTestCase extends DrupalWebTestCase {
*/
function testPagePreviewWithRevisions() {
$langcode = FIELD_LANGUAGE_NONE;
+ $title_key = "title[$langcode][0][value]";
$body_key = "body[$langcode][0][value]";
// Force revision on page content.
variable_set('node_options_page', array('status', 'revision'));
// Fill in node creation form and preview node.
$edit = array();
- $edit['title'] = $this->randomName(8);
+ $edit[$title_key] = $this->randomName(8);
$edit[$body_key] = $this->randomName(16);
$edit['log'] = $this->randomName(32);
$this->drupalPost('node/add/page', $edit, t('Preview'));
// Check that the preview is displaying the title and body.
$this->assertTitle(t('Preview | Drupal'), t('Page title is preview.'));
- $this->assertText($edit['title'], t('Title displayed.'));
+ $this->assertText($edit[$title_key], t('Title displayed.'));
$this->assertText($edit[$body_key], t('Body displayed.'));
// Check that the title and body fields are displayed with the correct values.
- $this->assertFieldByName('title', $edit['title'], t('Title field displayed.'));
+ $this->assertFieldByName($title_key, $edit[$title_key], t('Title field displayed.'));
$this->assertFieldByName($body_key, $edit[$body_key], t('Body field displayed.'));
// Check that the log field has the correct value.
@@ -336,16 +339,16 @@ class PageCreationTestCase extends DrupalWebTestCase {
function testPageCreation() {
// Create a node.
$edit = array();
- $edit['title'] = $this->randomName(8);
$langcode = FIELD_LANGUAGE_NONE;
+ $edit["title[$langcode][0][value]"] = $this->randomName(8);
$edit["body[$langcode][0][value]"] = $this->randomName(16);
$this->drupalPost('node/add/page', $edit, t('Save'));
// Check that the page has been created.
- $this->assertRaw(t('!post %title has been created.', array('!post' => 'Page', '%title' => $edit['title'])), t('Page created.'));
+ $this->assertRaw(t('!post %title has been created.', array('!post' => 'Page', '%title' => $edit["title[$langcode][0][value]"])), t('Page created.'));
// Check that the node exists in the database.
- $node = $this->drupalGetNodeByTitle($edit['title']);
+ $node = $this->drupalGetNodeByTitle($edit["title[$langcode][0][value]"]);
$this->assertTrue($node, t('Node found in database.'));
}
}
@@ -446,18 +449,21 @@ class NodeTitleXSSTestCase extends DrupalWebTestCase {
$this->drupalLogin($web_user);
$xss = '<script>alert("xss")</script>';
-
+ $title = $xss . $this->randomName();
+ $langcode = FIELD_LANGUAGE_NONE;
$edit = array(
- 'title' => $xss . $this->randomName(),
+ "title[$langcode][0][value]" => $title,
);
+
$this->drupalPost('node/add/page', $edit, t('Preview'));
$this->assertNoRaw($xss, t('Harmful tags are escaped when previewing a node.'));
- $node = $this->drupalCreateNode($edit);
+ $settings = array('title' => array(FIELD_LANGUAGE_NONE => array(array('value' => $title))));
+ $node = $this->drupalCreateNode($settings);
$this->drupalGet('node/' . $node->nid);
// assertTitle() decodes HTML-entities inside the <title> element.
- $this->assertTitle($edit['title'] . ' | Drupal', t('Title is diplayed when viewing a node.'));
+ $this->assertTitle($edit["title[$langcode][0][value]"] . ' | Drupal', t('Title is diplayed when viewing a node.'));
$this->assertNoRaw($xss, t('Harmful tags are escaped when viewing a node.'));
$this->drupalGet('node/' . $node->nid . '/edit');
@@ -526,13 +532,13 @@ class NodePostSettingsTestCase extends DrupalWebTestCase {
// Create a node.
$edit = array();
- $edit['title'] = $this->randomName(8);
$langcode = FIELD_LANGUAGE_NONE;
+ $edit["title[$langcode][0][value]"] = $this->randomName(8);
$edit["body[$langcode][0][value]"] = $this->randomName(16);
$this->drupalPost('node/add/page', $edit, t('Save'));
// Check that the post information is displayed.
- $node = $this->drupalGetNodeByTitle($edit['title']);
+ $node = $this->drupalGetNodeByTitle($edit["title[$langcode][0][value]"]);
$this->assertRaw('<span class="submitted">', t('Post information is displayed.'));
}
@@ -548,13 +554,13 @@ class NodePostSettingsTestCase extends DrupalWebTestCase {
// Create a node.
$edit = array();
- $edit['title'] = $this->randomName(8);
$langcode = FIELD_LANGUAGE_NONE;
+ $edit["title[$langcode][0][value]"] = $this->randomName(8);
$edit["body[$langcode][0][value]"] = $this->randomName(16);
$this->drupalPost('node/add/page', $edit, t('Save'));
// Check that the post information is displayed.
- $node = $this->drupalGetNodeByTitle($edit['title']);
+ $node = $this->drupalGetNodeByTitle($edit["title[$langcode][0][value]"]);
$this->assertNoRaw('<span class="submitted">', t('Post information is not displayed.'));
}
}
@@ -792,7 +798,7 @@ class NodeSaveTestCase extends DrupalWebTestCase {
$test_nid = $max_nid + mt_rand(1000, 1000000);
$title = $this->randomName(8);
$node = array(
- 'title' => $title,
+ 'title' => array(FIELD_LANGUAGE_NONE => array(array('value' => $title))),
'body' => array(FIELD_LANGUAGE_NONE => array(array('value' => $this->randomName(32)))),
'uid' => $this->web_user->uid,
'type' => 'article',
@@ -966,7 +972,7 @@ class NodeAdminTestCase extends DrupalWebTestCase {
$node3 = $this->drupalCreateNode(array('type' => 'page'));
$this->drupalGet('admin/content');
- $this->assertText($node1->title, t('Node appears on the node administration listing.'));
+ $this->assertText($node1->title[FIELD_LANGUAGE_NONE][0]['value'], t('Node appears on the node administration listing.'));
// Filter the node listing by status.
$edit = array(
@@ -975,8 +981,8 @@ class NodeAdminTestCase extends DrupalWebTestCase {
);
$this->drupalPost('admin/content', $edit, t('Filter'));
$this->assertRaw(t('<strong>%type</strong> is <strong>%value</strong>', array('%type' => t('status'), '%value' => t('published'))), t('The node administration listing is filtered by status.'));
- $this->assertText($node1->title, t('Published node appears on the node administration listing.'));
- $this->assertNoText($node2->title, t('Unpublished node does not appear on the node administration listing.'));
+ $this->assertText($node1->title[FIELD_LANGUAGE_NONE][0]['value'], t('Published node appears on the node administration listing.'));
+ $this->assertNoText($node2->title[FIELD_LANGUAGE_NONE][0]['value'], t('Unpublished node does not appear on the node administration listing.'));
// Filter the node listing by content type.
$edit = array(
@@ -986,7 +992,53 @@ class NodeAdminTestCase extends DrupalWebTestCase {
$this->drupalPost('admin/content', $edit, t('Refine'));
$this->assertRaw(t('<strong>%type</strong> is <strong>%value</strong>', array('%type' => t('status'), '%value' => t('published'))), t('The node administration listing is filtered by status.'));
$this->assertRaw(t('<strong>%type</strong> is <strong>%value</strong>', array('%type' => t('type'), '%value' => 'Article')), t('The node administration listing is filtered by content type.'));
- $this->assertText($node1->title, t('Article node appears on the node administration listing.'));
- $this->assertNoText($node3->title, t('Page node does not appear on the node administration listing.'));
+ $this->assertText($node1->title[FIELD_LANGUAGE_NONE][0]['value'], t('Article node appears on the node administration listing.'));
+ $this->assertNoText($node3->title[FIELD_LANGUAGE_NONE][0]['value'], t('Page node does not appear on the node administration listing.'));
+ }
+}
+
+/**
+ * Test node title.
+ */
+class NodeTitleTestCase extends DrupalWebTestCase {
+ protected $admin_user;
+
+ public static function getInfo() {
+ return array(
+ 'name' => 'Node title',
+ 'description' => 'Test node title.',
+ 'group' => 'Node'
+ );
+ }
+
+ function setUp() {
+ parent::setUp();
+ $this->admin_user = $this->drupalCreateUser(array('administer nodes', 'create article content', 'create page content'));
+ $this->drupalLogin($this->admin_user);
+ }
+
+ /**
+ * Create one node and test if the node title has the correct value.
+ */
+ function testNodeTitle() {
+ // Create page content with title
+ $settings = array(
+ 'title' => array(FIELD_LANGUAGE_NONE => array(array('value' => $this->randomName(8)))),
+ );
+ $node = $this->drupalCreateNode($settings);
+
+ // Test <title> tag.
+ $this->drupalGet("node/$node->nid");
+ $xpath = '//title';
+ $this->assertEqual(current($this->xpath($xpath)), $node->title[FIELD_LANGUAGE_NONE][0]['value'] .' | Drupal', 'Page title is equal to node title.', 'Node');
+
+ // Test breadcrumb in comment preview.
+ $this->drupalGet("comment/reply/$node->nid");
+ $xpath = '//div[@class="breadcrumb"]/a[last()]';
+ $this->assertEqual(current($this->xpath($xpath)), $node->title[FIELD_LANGUAGE_NONE][0]['value'], 'Node breadcrumb is equal to node title.', 'Node');
+
+ // Test node title in comment preview.
+ $xpath = '//div[@id="node-'. $node->nid .'"]/h2/a';
+ $this->assertEqual(current($this->xpath($xpath)), $node->title[FIELD_LANGUAGE_NONE][0]['value'], 'Node preview title is equal to node title.', 'Node');
}
}
diff --git a/modules/node/node.tokens.inc b/modules/node/node.tokens.inc
index 4fb5dd402..06380fc79 100644
--- a/modules/node/node.tokens.inc
+++ b/modules/node/node.tokens.inc
@@ -134,7 +134,7 @@ function node_tokens($type, $tokens, array $data = array(), array $options = arr
break;
case 'title':
- $replacements[$original] = $sanitize ? check_plain($node->title) : $node->title;
+ $replacements[$original] = $sanitize ? check_plain($node->title[FIELD_LANGUAGE_NONE][0]['value']) : $node->title[FIELD_LANGUAGE_NONE][0]['value'];
break;
case 'body':
diff --git a/modules/node/node.tpl.php b/modules/node/node.tpl.php
index 1bc4c2c6e..99acaf5b2 100644
--- a/modules/node/node.tpl.php
+++ b/modules/node/node.tpl.php
@@ -75,7 +75,7 @@
<?php print $user_picture; ?>
<?php if (!$page): ?>
- <h2<?php print $title_attributes; ?>><a href="<?php print $node_url; ?>"><?php print $title; ?></a></h2>
+ <h2<?php print $title_attributes; ?>>a href="<?php print $node_url; ?>"><?php print $node_title; ?></a></h2>
<?php endif; ?>
<?php if ($display_submitted || !empty($content['links']['terms'])): ?>
diff --git a/modules/path/path.test b/modules/path/path.test
index 21cbb5ab9..974ffb96d 100644
--- a/modules/path/path.test
+++ b/modules/path/path.test
@@ -66,7 +66,7 @@ class PathTestCase extends DrupalWebTestCase {
// Confirm that the alias works.
$this->drupalGet($edit['dst']);
- $this->assertText($node1->title, 'Alias works.');
+ $this->assertText($node1->title[FIELD_LANGUAGE_NONE][0]['value'], 'Alias works.');
// Change alias.
$pid = $this->getPID($edit['dst']);
@@ -77,7 +77,7 @@ class PathTestCase extends DrupalWebTestCase {
// Confirm that the alias works.
$this->drupalGet($edit['dst']);
- $this->assertText($node1->title, 'Changed alias works.');
+ $this->assertText($node1->title[FIELD_LANGUAGE_NONE][0]['value'], 'Changed alias works.');
// Confirm that previous alias no longer works.
$this->drupalGet($previous);
@@ -117,7 +117,7 @@ class PathTestCase extends DrupalWebTestCase {
// Confirm that the alias works.
$this->drupalGet($edit['path']);
- $this->assertText($node1->title, 'Alias works.');
+ $this->assertText($node1->title[FIELD_LANGUAGE_NONE][0]['value'], 'Alias works.');
// Change alias.
$previous = $edit['path'];
@@ -126,11 +126,11 @@ class PathTestCase extends DrupalWebTestCase {
// Confirm that the alias works.
$this->drupalGet($edit['path']);
- $this->assertText($node1->title, 'Changed alias works.');
+ $this->assertText($node1->title[FIELD_LANGUAGE_NONE][0]['value'], 'Changed alias works.');
// Make sure that previous alias no longer works.
$this->drupalGet($previous);
- $this->assertNoText($node1->title, 'Previous alias no longer works.');
+ $this->assertNoText($node1->title[FIELD_LANGUAGE_NONE][0]['value'], 'Previous alias no longer works.');
$this->assertResponse(404);
// Create second test node.
@@ -208,14 +208,14 @@ class PathLanguageTestCase extends DrupalWebTestCase {
// Confirm that the alias works.
$this->drupalGet($edit['path']);
- $this->assertText($english_node->title, 'Alias works.');
+ $this->assertText($english_node->title[FIELD_LANGUAGE_NONE][0]['value'], 'Alias works.');
// Translate the node into French.
$this->drupalGet('node/' . $english_node->nid . '/translate');
$this->clickLink(t('add translation'));
$edit = array();
- $edit['title'] = $this->randomName();
$langcode = FIELD_LANGUAGE_NONE;
+ $edit["title[$langcode][0][value]"] = $this->randomName();
$edit["body[$langcode][0][value]"] = $this->randomName();
$edit['path'] = $this->randomName();
$this->drupalPost(NULL, $edit, t('Save'));
@@ -225,12 +225,12 @@ class PathLanguageTestCase extends DrupalWebTestCase {
// Ensure the node was created.
// Check to make sure the node was created.
- $french_node = $this->drupalGetNodeByTitle($edit['title']);
+ $french_node = $this->drupalGetNodeByTitle($edit["title[$langcode][0][value]"]);
$this->assertTrue(($french_node), 'Node found in database.');
// Confirm that the alias works.
$this->drupalGet('fr/' . $edit['path']);
- $this->assertText($french_node->title, 'Alias for French translation works.');
+ $this->assertText($french_node->title[FIELD_LANGUAGE_NONE][0]['value'], 'Alias for French translation works.');
// Confirm that the alias is returned by url().
$languages = language_list();
diff --git a/modules/php/php.test b/modules/php/php.test
index 5b995ed6f..142f7a858 100644
--- a/modules/php/php.test
+++ b/modules/php/php.test
@@ -67,7 +67,7 @@ class PHPFilterTestCase extends PHPTestCase {
$langcode = FIELD_LANGUAGE_NONE;
$edit["body[$langcode][0][value_format]"] = $this->php_code_format;
$this->drupalPost('node/' . $node->nid . '/edit', $edit, t('Save'));
- $this->assertRaw(t('Page %title has been updated.', array('%title' => $node->title)), t('PHP code filter turned on.'));
+ $this->assertRaw(t('Page %title has been updated.', array('%title' => $node->title[FIELD_LANGUAGE_NONE][0]['value'])), t('PHP code filter turned on.'));
// Make sure that the PHP code shows up as text.
$this->assertNoText('print', t('PHP code isn\'t displayed.'));
diff --git a/modules/poll/poll.module b/modules/poll/poll.module
index 985ddc118..95c29ce05 100644
--- a/modules/poll/poll.module
+++ b/modules/poll/poll.module
@@ -222,14 +222,6 @@ function poll_form($node, $form_state) {
'#cache' => TRUE,
);
- $form['title'] = array(
- '#type' => 'textfield',
- '#title' => check_plain($type->title_label),
- '#required' => TRUE,
- '#default_value' => $node->title,
- '#weight' => -5,
- );
-
if (isset($form_state['choice_count'])) {
$choice_count = $form_state['choice_count'];
}
@@ -716,7 +708,7 @@ function poll_vote($form, &$form_state) {
function template_preprocess_poll_vote(&$variables) {
$form = $variables['form'];
$variables['choice'] = drupal_render($form['choice']);
- $variables['title'] = check_plain($form['#node']->title);
+ $variables['title'] = check_plain($form['#node']->title[FIELD_LANGUAGE_NONE][0]['value']);
$variables['vote'] = drupal_render($form['vote']);
$variables['rest'] = drupal_render_children($form);
$variables['block'] = $form['#block'];
@@ -748,7 +740,7 @@ function poll_view_results($node, $build_mode, $block = FALSE) {
}
}
- return theme('poll_results', array('raw_title' => $node->title, 'results' => $poll_results, 'votes' => $total_votes, 'raw_links' => isset($node->links) ? $node->links : array(), 'block' => $block, 'nid' => $node->nid, 'vote' => isset($node->vote) ? $node->vote : NULL));
+ return theme('poll_results', array('raw_title' => $node->title[FIELD_LANGUAGE_NONE][0]['value'], 'results' => $poll_results, 'votes' => $total_votes, 'raw_links' => isset($node->links) ? $node->links : array(), 'block' => $block, 'nid' => $node->nid, 'vote' => isset($node->vote) ? $node->vote : NULL));
}
diff --git a/modules/poll/poll.pages.inc b/modules/poll/poll.pages.inc
index 80cb24479..0b9e255e5 100644
--- a/modules/poll/poll.pages.inc
+++ b/modules/poll/poll.pages.inc
@@ -51,7 +51,7 @@ function poll_page() {
*/
function poll_votes($node) {
$votes_per_page = 20;
- drupal_set_title($node->title);
+ drupal_set_title($node->title[FIELD_LANGUAGE_NONE][0]['value']);
$header[] = array('data' => t('Visitor'), 'field' => 'u.name');
$header[] = array('data' => t('Vote'), 'field' => 'pc.chtext');
@@ -91,7 +91,7 @@ function poll_votes($node) {
* Callback for the 'results' tab for polls you can vote on
*/
function poll_results($node) {
- drupal_set_title($node->title);
+ drupal_set_title($node->title[FIELD_LANGUAGE_NONE][0]['value']);
$node->show_results = TRUE;
return node_show($node);
}
diff --git a/modules/poll/poll.test b/modules/poll/poll.test
index c7f8e5c17..38d5b9c9b 100644
--- a/modules/poll/poll.test
+++ b/modules/poll/poll.test
@@ -57,8 +57,9 @@ class PollTestCase extends DrupalWebTestCase {
$already_submitted_choices = array_slice($choices, 0, $index);
$new_choices = array_values(array_slice($choices, $index, $max_new_choices));
+ $langcode = FIELD_LANGUAGE_NONE;
$edit = array(
- 'title' => $title
+ "title[$langcode][0][value]" => $title
);
foreach ($already_submitted_choices as $k => $text) {
$edit['choice[chid:' . $k . '][chtext]'] = $text;
@@ -331,8 +332,9 @@ class PollJSAddChoice extends DrupalWebTestCase {
$web_user = $this->drupalCreateUser(array('create poll content', 'access content'));
$this->drupalLogin($web_user);
$this->drupalGet('node/add/poll');
+ $langcode = FIELD_LANGUAGE_NONE;
$edit = array(
- 'title' => $this->randomName(),
+ "title[$langcode][0][value]" => $this->randomName(),
'choice[new:0][chtext]' => $this->randomName(),
'choice[new:1][chtext]' => $this->randomName(),
);
diff --git a/modules/search/search.api.php b/modules/search/search.api.php
index 0cfb1a1e6..a3170087c 100644
--- a/modules/search/search.api.php
+++ b/modules/search/search.api.php
@@ -191,7 +191,7 @@ function hook_search_execute($keys = NULL) {
$results[] = array(
'link' => url('node/' . $item->sid, array('absolute' => TRUE)),
'type' => check_plain(node_type_get_name($node)),
- 'title' => $node->title,
+ 'title' => $node->title[FIELD_LANGUAGE_NONE][0]['value'],
'user' => theme('username', array('account' => $node)),
'date' => $node->changed,
'node' => $node,
@@ -267,7 +267,7 @@ function hook_update_index() {
node_build_content($node, 'search_index');
$node->rendered = drupal_render($node->content);
- $text = '<h1>' . check_plain($node->title) . '</h1>' . $node->rendered;
+ $text = '<h1>' . check_plain($node->title[FIELD_LANGUAGE_NONE][0]['value']) . '</h1>' . $node->rendered;
// Fetch extra data normally not visible
$extra = module_invoke_all('node_update_index', $node);
diff --git a/modules/search/search.test b/modules/search/search.test
index 7ffcbf2ab..357789039 100644
--- a/modules/search/search.test
+++ b/modules/search/search.test
@@ -280,17 +280,17 @@ class SearchAdvancedSearchForm extends DrupalWebTestCase {
$this->assertNoText($this->node->title, t('Page node is not found with dummy title.'));
// Search for the title of the node with a GET query.
- $this->drupalGet('search/node/' . $this->node->title);
- $this->assertText($this->node->title, t('Page node is found with GET query.'));
+ $this->drupalGet('search/node/' . $this->node->title[FIELD_LANGUAGE_NONE][0]['value']);
+ $this->assertText($this->node->title[FIELD_LANGUAGE_NONE][0]['value'], t('Page node is found with GET query.'));
// Search for the title of the node with a POST query.
- $edit = array('or' => $this->node->title);
+ $edit = array('or' => $this->node->title[FIELD_LANGUAGE_NONE][0]['value']);
$this->drupalPost('search/node', $edit, t('Advanced search'));
- $this->assertText($this->node->title, t('Page node is found with POST query.'));
+ $this->assertText($this->node->title[FIELD_LANGUAGE_NONE][0]['value'], t('Page node is found with POST query.'));
// Advanced search type option.
$this->drupalPost('search/node', array_merge($edit, array('type[page]' => 'page')), t('Advanced search'));
- $this->assertText($this->node->title, t('Page node is found with POST query and type:page.'));
+ $this->assertText($this->node->title[FIELD_LANGUAGE_NONE][0]['value'], t('Page node is found with POST query and type:page.'));
$this->drupalPost('search/node', array_merge($edit, array('type[article]' => 'article')), t('Advanced search'));
$this->assertText('bike shed', t('Article node is not found with POST query and type:article.'));
@@ -322,7 +322,7 @@ class SearchRankingTestCase extends DrupalWebTestCase {
// Create nodes for testing.
foreach ($node_ranks as $node_rank) {
- $settings = array('type' => 'page', 'title' => 'Drupal rocks', 'body' => array(FIELD_LANGUAGE_NONE => array(array('value' => "Drupal's search rocks"))));
+ $settings = array('type' => 'page', 'title' => array(FIELD_LANGUAGE_NONE => array(array('value' => 'Drupal rocks'))), 'body' => array(FIELD_LANGUAGE_NONE => array(array('value' => "Drupal's search rocks"))));
foreach (array(0, 1) as $num) {
if ($num == 1) {
switch ($node_rank) {
@@ -506,7 +506,7 @@ class SearchCommentTestCase extends DrupalWebTestCase {
'search_block_form' => $comment_body,
);
$this->drupalPost('', $edit, t('Search'));
- $this->assertText($node->title, t('Node found in search results.'));
+ $this->assertText($node->title[FIELD_LANGUAGE_NONE][0]['value'], t('Node found in search results.'));
// Verify that comment is rendered using proper format.
$this->assertText($edit_comment['subject'], t('Comment subject found in search results.'));
diff --git a/modules/simpletest/drupal_web_test_case.php b/modules/simpletest/drupal_web_test_case.php
index 66154ec7e..edab20875 100644
--- a/modules/simpletest/drupal_web_test_case.php
+++ b/modules/simpletest/drupal_web_test_case.php
@@ -694,7 +694,7 @@ class DrupalWebTestCase extends DrupalTestCase {
// Populate defaults array.
$settings += array(
'body' => array(FIELD_LANGUAGE_NONE => array(array())),
- 'title' => $this->randomName(8),
+ 'title' => array(FIELD_LANGUAGE_NONE => array(array('value' => $this->randomName(8)))),
'comment' => 2,
'changed' => REQUEST_TIME,
'moderate' => 0,
diff --git a/modules/statistics/statistics.pages.inc b/modules/statistics/statistics.pages.inc
index b58f1db53..b74b5d703 100644
--- a/modules/statistics/statistics.pages.inc
+++ b/modules/statistics/statistics.pages.inc
@@ -42,7 +42,7 @@ function statistics_node_tracker() {
$rows[] = array(array('data' => t('No statistics available.'), 'colspan' => 4));
}
- drupal_set_title($node->title);
+ drupal_set_title($node->title[FIELD_LANGUAGE_NONE][0]['value']);
$build['statistics_table'] = array(
'#theme' => 'table',
'#header' => $header,
diff --git a/modules/system/system.api.php b/modules/system/system.api.php
index 13a71ec5e..e8e4f5935 100644
--- a/modules/system/system.api.php
+++ b/modules/system/system.api.php
@@ -1099,7 +1099,7 @@ function hook_mail($key, &$message, $params) {
'%uid' => $node->uid,
'%node_url' => url('node/' . $node->nid, array('absolute' => TRUE)),
'%node_type' => node_type_get_name($node),
- '%title' => $node->title,
+ '%title' => $node->title[FIELD_LANGUAGE_NONE][0]['value'],
'%teaser' => $node->teaser,
'%body' => $node->body,
);
diff --git a/modules/system/system.test b/modules/system/system.test
index 05b42f290..fdf6887bb 100644
--- a/modules/system/system.test
+++ b/modules/system/system.test
@@ -533,7 +533,7 @@ class AccessDeniedTestCase extends DrupalWebTestCase {
$this->assertText(t('Access denied'), t('Found the default 403 page'));
$edit = array(
- 'title' => $this->randomName(10),
+ 'title' => array(FIELD_LANGUAGE_NONE => array(array('value' => $this->randomName(10)))),
'body' => array(FIELD_LANGUAGE_NONE => array(array('value' => $this->randomName(100)))),
);
$node = $this->drupalCreateNode($edit);
@@ -542,13 +542,13 @@ class AccessDeniedTestCase extends DrupalWebTestCase {
$this->drupalPost('admin/config/system/site-information', array('site_403' => 'node/' . $node->nid), t('Save configuration'));
$this->drupalGet('admin');
- $this->assertText($node->title, t('Found the custom 403 page'));
+ $this->assertText($node->title[FIELD_LANGUAGE_NONE][0]['value'], t('Found the custom 403 page'));
// Logout and check that the user login block is shown on custom 403 pages.
$this->drupalLogout();
$this->drupalGet('admin');
- $this->assertText($node->title, t('Found the custom 403 page'));
+ $this->assertText($node->title[FIELD_LANGUAGE_NONE][0]['value'], t('Found the custom 403 page'));
$this->assertText(t('User login'), t('Blocks are shown on the custom 403 page'));
// Log back in and remove the custom 403 page.
@@ -610,7 +610,7 @@ class PageNotFoundTestCase extends DrupalWebTestCase {
$this->assertText(t('Page not found'), t('Found the default 404 page'));
$edit = array(
- 'title' => $this->randomName(10),
+ 'title' => array(FIELD_LANGUAGE_NONE => array(array('value' => $this->randomName(10)))),
'body' => array(FIELD_LANGUAGE_NONE => array(array('value' => $this->randomName(100)))),
);
$node = $this->drupalCreateNode($edit);
@@ -619,7 +619,7 @@ class PageNotFoundTestCase extends DrupalWebTestCase {
$this->drupalPost('admin/config/system/site-information', array('site_404' => 'node/' . $node->nid), t('Save configuration'));
$this->drupalGet($this->randomName(10));
- $this->assertText($node->title, t('Found the custom 404 page'));
+ $this->assertText($node->title[FIELD_LANGUAGE_NONE][0]['value'], t('Found the custom 404 page'));
}
}
@@ -805,16 +805,16 @@ class PageTitleFiltering extends DrupalWebTestCase {
// Generate node content.
$langcode = FIELD_LANGUAGE_NONE;
$edit = array(
- 'title' => '!SimpleTest! ' . $title . $this->randomName(20),
+ "title[$langcode][0][value]" => '!SimpleTest! ' . $title . $this->randomName(20),
"body[$langcode][0][value]" => '!SimpleTest! test body' . $this->randomName(200),
);
// Create the node with HTML in the title.
$this->drupalPost('node/add/page', $edit, t('Save'));
- $node = $this->drupalGetNodeByTitle($edit['title']);
+ $node = $this->drupalGetNodeByTitle($edit["title[$langcode][0][value]"]);
$this->assertNotNull($node, 'Node created and found in database');
$this->drupalGet("node/" . $node->nid);
- $this->assertText(check_plain($edit['title']), 'Check to make sure tags in the node title are converted.');
+ $this->assertText(check_plain($edit["title[$langcode][0][value]"]), 'Check to make sure tags in the node title are converted.');
}
}
@@ -1184,7 +1184,7 @@ class TokenReplaceTestCase extends DrupalWebTestCase {
// Create the initial objects.
$account = $this->drupalCreateUser();
$node = $this->drupalCreateNode(array('uid' => $account->uid));
- $node->title = '<blink>Blinking Text</blink>';
+ $node->title = array(FIELD_LANGUAGE_NONE => array(array('value' => '<blink>Blinking Text</blink>')));
global $user, $language;
$source = '[node:title]'; // Title of the node we passed in
@@ -1195,7 +1195,7 @@ class TokenReplaceTestCase extends DrupalWebTestCase {
$source .= '[date:short]'; // Short date format of REQUEST_TIME
$source .= '[bogus:token]'; // Nonexistent token, should be untouched
- $target = check_plain($node->title);
+ $target = check_plain($node->title[FIELD_LANGUAGE_NONE][0]['value']);
$target .= check_plain($account->name);
$target .= format_interval(REQUEST_TIME - $node->created, 2, $language->language);
$target .= check_plain($user->name);
@@ -1213,10 +1213,10 @@ class TokenReplaceTestCase extends DrupalWebTestCase {
$raw_tokens = array('title' => '[node:title]');
$generated = token_generate('node', $raw_tokens, array('node' => $node));
- $this->assertFalse(strcmp($generated['[node:title]'], check_plain($node->title)), t('Token sanitized.'));
+ $this->assertFalse(strcmp($generated['[node:title]'], check_plain($node->title[FIELD_LANGUAGE_NONE][0]['value'])), t('Token sanitized.'));
$generated = token_generate('node', $raw_tokens, array('node' => $node), array('sanitize' => FALSE));
- $this->assertFalse(strcmp($generated['[node:title]'], $node->title), t('Unsanitized token generated properly.'));
+ $this->assertFalse(strcmp($generated['[node:title]'], $node->title[FIELD_LANGUAGE_NONE][0]['value']), t('Unsanitized token generated properly.'));
}
}
diff --git a/modules/system/system.tokens.inc b/modules/system/system.tokens.inc
index 01687f0c2..fb42f1633 100644
--- a/modules/system/system.tokens.inc
+++ b/modules/system/system.tokens.inc
@@ -283,7 +283,7 @@ function system_tokens($type, $tokens, array $data = array(), array $options = a
case 'node':
if ($nid = $file->nid) {
$node = node_load($file->nid);
- $replacements[$original] = $sanitize ? filter_xss($node->title) : $node->title;
+ $replacements[$original] = $sanitize ? filter_xss($node->title[FIELD_LANGUAGE_NONE][0]['value']) : $node->title[FIELD_LANGUAGE_NONE][0]['value'];
}
break;
diff --git a/modules/taxonomy/taxonomy.test b/modules/taxonomy/taxonomy.test
index 639f7b4aa..af138182e 100644
--- a/modules/taxonomy/taxonomy.test
+++ b/modules/taxonomy/taxonomy.test
@@ -396,14 +396,14 @@ class TaxonomyTermTestCase extends TaxonomyWebTestCase {
// Post an article.
$edit = array();
- $edit['title'] = $this->randomName();
$langcode = FIELD_LANGUAGE_NONE;
+ $edit["title[$langcode][0][value]"] = $this->randomName();
$edit["body[$langcode][0][value]"] = $this->randomName();
$edit[$this->instance['field_name'] . '[' . $langcode .'][value][]'] = $term1->tid;
$this->drupalPost('node/add/article', $edit, t('Save'));
// Check that the term is displayed when the node is viewed.
- $node = $this->drupalGetNodeByTitle($edit['title']);
+ $node = $this->drupalGetNodeByTitle($edit["title[$langcode][0][value]"]);
$this->drupalGet('node/' . $node->nid);
$this->assertText($term1->name, t('Term is displayed when viewing the node.'));
@@ -431,14 +431,14 @@ class TaxonomyTermTestCase extends TaxonomyWebTestCase {
);
$edit = array();
- $edit['title'] = $this->randomName();
$langcode = FIELD_LANGUAGE_NONE;
+ $edit["title[$langcode][0][value]"] = $this->randomName();
$edit["body[$langcode][0][value]"] = $this->randomName();
// Insert the terms in a comma separated list. Vocabulary 1 is a
// free-tagging field created by the default profile.
$edit[$instance['field_name'] . "[$langcode][value]"] = implode(', ', $terms);
$this->drupalPost('node/add/page', $edit, t('Save'));
- $this->assertRaw(t('@type %title has been created.', array('@type' => t('Page'), '%title' => $edit['title'])), t('The node was created successfully'));
+ $this->assertRaw(t('@type %title has been created.', array('@type' => t('Page'), '%title' => $edit["title[$langcode][0][value]"])), t('The node was created successfully'));
foreach ($terms as $term) {
$this->assertText($term, t('The term was saved and appears on the node page'));
}
diff --git a/modules/tracker/tracker.test b/modules/tracker/tracker.test
index 7aa215bd1..e304be310 100644
--- a/modules/tracker/tracker.test
+++ b/modules/tracker/tracker.test
@@ -32,17 +32,17 @@ class TrackerTest extends DrupalWebTestCase {
$this->drupalLogin($this->user);
$unpublished = $this->drupalCreateNode(array(
- 'title' => $this->randomName(8),
+ 'title' => array(FIELD_LANGUAGE_NONE => array(array('value' => $this->randomName(8)))),
'status' => 0,
));
$published = $this->drupalCreateNode(array(
- 'title' => $this->randomName(8),
+ 'title' => array(FIELD_LANGUAGE_NONE => array(array('value' => $this->randomName(8)))),
'status' => 1,
));
$this->drupalGet('tracker');
- $this->assertNoText($unpublished->title, t('Unpublished node do not show up in the tracker listing.'));
- $this->assertText($published->title, t('Published node show up in the tracker listing.'));
+ $this->assertNoText($unpublished->title[FIELD_LANGUAGE_NONE][0]['value'], t('Unpublished node do not show up in the tracker listing.'));
+ $this->assertText($published->title[FIELD_LANGUAGE_NONE][0]['value'], t('Published node show up in the tracker listing.'));
$this->assertLink(t('My recent posts'), 0, t('User tab shows up on the global tracker page.'));
}
@@ -53,22 +53,22 @@ class TrackerTest extends DrupalWebTestCase {
$this->drupalLogin($this->user);
$unpublished = $this->drupalCreateNode(array(
- 'title' => $this->randomName(8),
+ 'title' => array(FIELD_LANGUAGE_NONE => array(array('value' => $this->randomName(8)))),
'uid' => $this->user->uid,
'status' => 0,
));
$my_published = $this->drupalCreateNode(array(
- 'title' => $this->randomName(8),
+ 'title' => array(FIELD_LANGUAGE_NONE => array(array('value' => $this->randomName(8)))),
'uid' => $this->user->uid,
'status' => 1,
));
$other_published_no_comment = $this->drupalCreateNode(array(
- 'title' => $this->randomName(8),
+ 'title' => array(FIELD_LANGUAGE_NONE => array(array('value' => $this->randomName(8)))),
'uid' => $this->other_user->uid,
'status' => 1,
));
$other_published_my_comment = $this->drupalCreateNode(array(
- 'title' => $this->randomName(8),
+ 'title' => array(FIELD_LANGUAGE_NONE => array(array('value' => $this->randomName(8)))),
'uid' => $this->other_user->uid,
'status' => 1,
));
@@ -79,10 +79,10 @@ class TrackerTest extends DrupalWebTestCase {
$this->drupalPost('comment/reply/' . $other_published_my_comment->nid, $comment, t('Save'));
$this->drupalGet('user/' . $this->user->uid . '/track');
- $this->assertNoText($unpublished->title, t("Unpublished nodes do not show up in the users's tracker listing."));
- $this->assertText($my_published->title, t("Published nodes show up in the user's tracker listing."));
- $this->assertNoText($other_published_no_comment->title, t("Other user's nodes do not show up in the user's tracker listing."));
- $this->assertText($other_published_my_comment->title, t("Nodes that the user has commented on appear in the user's tracker listing."));
+ $this->assertNoText($unpublished->title[FIELD_LANGUAGE_NONE][0]['value'], t("Unpublished nodes do not show up in the users's tracker listing."));
+ $this->assertText($my_published->title[FIELD_LANGUAGE_NONE][0]['value'], t("Published nodes show up in the user's tracker listing."));
+ $this->assertNoText($other_published_no_comment->title[FIELD_LANGUAGE_NONE][0]['value'], t("Other user's nodes do not show up in the user's tracker listing."));
+ $this->assertText($other_published_my_comment->title[FIELD_LANGUAGE_NONE][0]['value'], t("Nodes that the user has commented on appear in the user's tracker listing."));
}
/**
@@ -92,24 +92,25 @@ class TrackerTest extends DrupalWebTestCase {
$this->drupalLogin($this->user);
$edit = array(
- 'title' => $this->randomName(),
+ 'title' => array(FIELD_LANGUAGE_NONE => array(array('value' => $this->randomName(8)))),
);
- $node = $this->drupalCreateNode($edit);
+ $node = $this->drupalCreateNode($edit);
+ $title = $edit['title'][FIELD_LANGUAGE_NONE][0]['value'];
$this->drupalGet('tracker');
- $this->assertPattern('/' . $edit['title'] . '.*new/', t('New nodes are flagged as such in the tracker listing.'));
+ $this->assertPattern('/' . $title . '.*new/', t('New nodes are flagged as such in the tracker listing.'));
$this->drupalGet('node/' . $node->nid);
$this->drupalGet('tracker');
- $this->assertNoPattern('/' . $edit['title'] . '.*new/', t('Visited nodes are not flagged as new.'));
+ $this->assertNoPattern('/' . $title . '.*new/', t('Visited nodes are not flagged as new.'));
$this->drupalLogin($this->other_user);
$this->drupalGet('tracker');
- $this->assertPattern('/' . $edit['title'] . '.*new/', t('For another user, new nodes are flagged as such in the tracker listing.'));
+ $this->assertPattern('/' . $title . '.*new/', t('For another user, new nodes are flagged as such in the tracker listing.'));
$this->drupalGet('node/' . $node->nid);
$this->drupalGet('tracker');
- $this->assertNoPattern('/' . $edit['title'] . '.*new/', t('For another user, visited nodes are not flagged as new.'));
+ $this->assertNoPattern('/' . $title . '.*new/', t('For another user, visited nodes are not flagged as new.'));
}
/**
@@ -120,7 +121,7 @@ class TrackerTest extends DrupalWebTestCase {
$node = $this->drupalCreateNode(array(
'comment' => 2,
- 'title' => $this->randomName(),
+ 'title' => array(FIELD_LANGUAGE_NONE => array(array('value' => $this->randomName(8)))),
));
// Add a comment to the page.
@@ -162,7 +163,7 @@ class TrackerTest extends DrupalWebTestCase {
for ($i = 1; $i <= 3; $i++) {
$edits[$i] = array(
'comment' => 2,
- 'title' => $this->randomName(),
+ 'title' => array(FIELD_LANGUAGE_NONE => array(array('value' => $this->randomName()))),
);
$nodes[$i] = $this->drupalCreateNode($edits[$i]);
}
@@ -192,7 +193,7 @@ class TrackerTest extends DrupalWebTestCase {
// Assert that all node titles are displayed.
foreach ($nodes as $i => $node) {
- $this->assertText($node->title, t('Node @i is displayed on the tracker listing pages.', array('@i' => $i)));
+ $this->assertText($node->title[FIELD_LANGUAGE_NONE][0]['value'], t('Node @i is displayed on the tracker listing pages.', array('@i' => $i)));
}
$this->assertText('1 new', t('New comment is counted on the tracker listing pages.'));
$this->assertText('updated', t('Node is listed as updated'));
@@ -203,7 +204,7 @@ class TrackerTest extends DrupalWebTestCase {
// Assert that all node titles are displayed.
foreach ($nodes as $i => $node) {
- $this->assertText($node->title, t('Node @i is displayed on the tracker listing pages.', array('@i' => $i)));
+ $this->assertText($node->title[FIELD_LANGUAGE_NONE][0]['value'], t('Node @i is displayed on the tracker listing pages.', array('@i' => $i)));
}
$this->assertText('1 new', t('New comment is counted on the tracker listing pages.'));
}
@@ -217,12 +218,12 @@ class TrackerTest extends DrupalWebTestCase {
$node = $this->drupalCreateNode(array(
'comment' => 2,
- 'title' => $this->randomName(),
+ 'title' => array(FIELD_LANGUAGE_NONE => array(array('value' => $this->randomName()))),
));
// Assert that the node is displayed.
$this->drupalGet('tracker');
- $this->assertText($node->title, t('Node is displayed on the tracker listing pages.'));
+ $this->assertText($node->title[FIELD_LANGUAGE_NONE][0]['value'], t('Node is displayed on the tracker listing pages.'));
// Unpublish the node and ensure that it's no longer displayed.
$edit = array(
diff --git a/modules/translation/translation.module b/modules/translation/translation.module
index a35dfb86a..08a801dea 100644
--- a/modules/translation/translation.module
+++ b/modules/translation/translation.module
@@ -202,7 +202,7 @@ function translation_node_prepare($node) {
$translations = translation_node_get_translations($source_node->tnid);
if (isset($translations[$language])) {
$languages = language_list();
- drupal_set_message(t('A translation of %title in %language already exists, a new %type will be created instead of a translation.', array('%title' => $source_node->title, '%language' => $languages[$language]->name, '%type' => $node->type)), 'error');
+ drupal_set_message(t('A translation of %title in %language already exists, a new %type will be created instead of a translation.', array('%title' => $source_node->title[FIELD_LANGUAGE_NONE][0]['value'], '%language' => $languages[$language]->name, '%type' => $node->type)), 'error');
return;
}
}
diff --git a/modules/translation/translation.pages.inc b/modules/translation/translation.pages.inc
index 50d8849ee..aa2a72177 100644
--- a/modules/translation/translation.pages.inc
+++ b/modules/translation/translation.pages.inc
@@ -33,7 +33,7 @@ function translation_node_overview($node) {
// Existing translation in the translation set: display status.
// We load the full node to check whether the user can edit it.
$translation_node = node_load($translations[$language->language]->nid);
- $title = l($translation_node->title, 'node/' . $translation_node->nid);
+ $title = l($translation_node->title[FIELD_LANGUAGE_NONE][0]['value'], 'node/' . $translation_node->nid);
if (node_access('update', $translation_node)) {
$options[] = l(t('edit'), "node/$translation_node->nid/edit");
}
@@ -54,7 +54,7 @@ function translation_node_overview($node) {
$rows[] = array($language_name, $title, $status, implode(" | ", $options));
}
- drupal_set_title(t('Translations of %title', array('%title' => $node->title)), PASS_THROUGH);
+ drupal_set_title(t('Translations of %title', array('%title' => $node->title[FIELD_LANGUAGE_NONE][0]['value'])), PASS_THROUGH);
$build['translation_node_overview'] = array(
'#theme' => 'table',
diff --git a/modules/translation/translation.test b/modules/translation/translation.test
index b15d20224..aae647a35 100644
--- a/modules/translation/translation.test
+++ b/modules/translation/translation.test
@@ -59,11 +59,11 @@ class TranslationTestCase extends DrupalWebTestCase {
// Attempt a resubmission of the form - this emulates using the back button
// to return to the page then resubmitting the form without a refresh.
$edit = array();
- $edit['title'] = $this->randomName();
$langcode = FIELD_LANGUAGE_NONE;
+ $edit["title[$langcode][0][value]"] = $this->randomName();
$edit["body[$langcode][0][value]"] = $this->randomName();
$this->drupalPost('node/add/page', $edit, t('Save'), array('query' => array('translation' => $node->nid, 'language' => 'es')));
- $duplicate = $this->drupalGetNodeByTitle($edit['title']);
+ $duplicate = $this->drupalGetNodeByTitle($edit["title[$langcode][0][value]"]);
$this->assertEqual($duplicate->tnid, 0, t('The node does not have a tnid.'));
// Update original and mark translation as outdated.
@@ -128,15 +128,15 @@ class TranslationTestCase extends DrupalWebTestCase {
*/
function createPage($title, $body, $language) {
$edit = array();
- $edit['title'] = $title;
$langcode = FIELD_LANGUAGE_NONE;
+ $edit["title[$langcode][0][value]"] = $title;
$edit["body[$langcode][0][value]"] = $body;
$edit['language'] = $language;
$this->drupalPost('node/add/page', $edit, t('Save'));
- $this->assertRaw(t('Page %title has been created.', array('%title' => $edit['title'])), t('Page created.'));
+ $this->assertRaw(t('Page %title has been created.', array('%title' => $edit["title[$langcode][0][value]"])), t('Page created.'));
// Check to make sure the node was created.
- $node = $this->drupalGetNodeByTitle($edit['title']);
+ $node = $this->drupalGetNodeByTitle($edit["title[$langcode][0][value]"]);
$this->assertTrue($node, t('Node found in database.'));
return $node;
@@ -154,14 +154,14 @@ class TranslationTestCase extends DrupalWebTestCase {
$this->drupalGet('node/add/page', array('query' => array('translation' => $nid, 'language' => $language)));
$edit = array();
- $edit['title'] = $title;
$langcode = FIELD_LANGUAGE_NONE;
+ $edit["title[$langcode][0][value]"] = $title;
$edit["body[$langcode][0][value]"] = $body;
$this->drupalPost(NULL, $edit, t('Save'));
- $this->assertRaw(t('Page %title has been created.', array('%title' => $edit['title'])), t('Translation created.'));
+ $this->assertRaw(t('Page %title has been created.', array('%title' => $edit["title[$langcode][0][value]"])), t('Translation created.'));
// Check to make sure that translation was successful.
- $node = $this->drupalGetNodeByTitle($edit['title']);
+ $node = $this->drupalGetNodeByTitle($edit["title[$langcode][0][value]"]);
$this->assertTrue($node, t('Node found in database.'));
return $node;
diff --git a/modules/trigger/trigger.test b/modules/trigger/trigger.test
index 4889bc59e..99a001640 100644
--- a/modules/trigger/trigger.test
+++ b/modules/trigger/trigger.test
@@ -37,15 +37,15 @@ class TriggerContentTestCase extends DrupalWebTestCase {
$web_user = $this->drupalCreateUser(array('create page content', 'access content', 'administer nodes'));
$this->drupalLogin($web_user);
$edit = array();
- $edit['title'] = '!SimpleTest test node! ' . $this->randomName(10);
$langcode = FIELD_LANGUAGE_NONE;
+ $edit["title[$langcode][0][value]"] = '!SimpleTest test node! ' . $this->randomName(10);
$edit["body[$langcode][0][value]"] = '!SimpleTest test body! ' . $this->randomName(32) . ' ' . $this->randomName(32);
$edit[$info['property']] = !$info['expected'];
$this->drupalPost('node/add/page', $edit, t('Save'));
// Make sure the text we want appears.
- $this->assertRaw(t('!post %title has been created.', array('!post' => 'Page', '%title' => $edit['title'])), t('Make sure the page has actually been created'));
+ $this->assertRaw(t('!post %title has been created.', array('!post' => 'Page', '%title' => $edit["title[$langcode][0][value]"])), t('Make sure the page has actually been created'));
// Action should have been fired.
- $loaded_node = $this->drupalGetNodeByTitle($edit['title']);;
+ $loaded_node = $this->drupalGetNodeByTitle($edit["title[$langcode][0][value]"]);;
$this->assertTrue($loaded_node->$info['property'] == $info['expected'], t('Make sure the @action action fired.', array('@action' => $info['name'])));
// Leave action assigned for next test
diff --git a/modules/upload/upload.test b/modules/upload/upload.test
index 70306ef30..09a297213 100644
--- a/modules/upload/upload.test
+++ b/modules/upload/upload.test
@@ -74,7 +74,7 @@ class UploadTestCase extends DrupalWebTestCase {
$edit = array();
$edit['files[' . $upload->fid . '][description]'] = $new_name = substr($upload->description, 1);
$this->drupalPost('node/' . $node->nid . '/edit', $edit, t('Save'));
- $this->assertRaw(t('Page %title has been updated.', array('%title' => $node->title)), 'File renamed successfully.');
+ $this->assertRaw(t('Page %title has been updated.', array('%title' => $node->title[FIELD_LANGUAGE_NONE][0]['value'])), 'File renamed successfully.');
$this->assertText($new_name, $new_name . ' found on node.');
$this->assertNoText($upload->description, $upload->description . ' not found on node.');
@@ -83,7 +83,7 @@ class UploadTestCase extends DrupalWebTestCase {
$edit = array();
$edit['files[' . $upload->fid . '][remove]'] = TRUE;
$this->drupalPost('node/' . $node->nid . '/edit', $edit, t('Save'));
- $this->assertRaw(t('Page %title has been updated.', array('%title' => $node->title)), 'File deleted successfully.');
+ $this->assertRaw(t('Page %title has been updated.', array('%title' => $node->title[FIELD_LANGUAGE_NONE][0]['value'])), 'File deleted successfully.');
$this->assertNoText($new_name, $new_name . ' not found on node.');
$uri = 'public://' . $upload->description;
@@ -197,7 +197,7 @@ class UploadTestCase extends DrupalWebTestCase {
$edit['files[upload]'] = $filename; //edit-upload
$this->drupalPost('node/' . $node->nid . '/edit', $edit, t('Save'));
if ($assert) {
- $this->assertRaw(t('Page %title has been updated.', array('%title' => $node->title)), 'File attached successfully.');
+ $this->assertRaw(t('Page %title has been updated.', array('%title' => $node->title[FIELD_LANGUAGE_NONE][0]['value'])), 'File attached successfully.');
}
}
diff --git a/themes/garland/node.tpl.php b/themes/garland/node.tpl.php
index 01038e21b..9a643117e 100644
--- a/themes/garland/node.tpl.php
+++ b/themes/garland/node.tpl.php
@@ -6,7 +6,7 @@
<?php print $user_picture; ?>
<?php if (!$page): ?>
- <h2<?php print $title_attributes; ?>><a href="<?php print $node_url; ?>"><?php print $title; ?></a></h2>
+ <h2<?php print $title_attributes; ?>><a href="<?php print $node_url; ?>"><?php print $node_title; ?></a></h2>
<?php endif; ?>
<?php if ($display_submitted): ?>