Index: modules/aggregator/aggregator.test =================================================================== RCS file: /cvs/drupal/drupal/modules/aggregator/aggregator.test,v retrieving revision 1.31 diff -u -p -r1.31 aggregator.test --- modules/aggregator/aggregator.test 24 Aug 2009 17:11:42 -0000 1.31 +++ modules/aggregator/aggregator.test 10 Sep 2009 13:29:08 -0000 @@ -252,7 +252,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')); } Index: modules/blog/blog.test =================================================================== RCS file: /cvs/drupal/drupal/modules/blog/blog.test,v retrieving revision 1.18 diff -u -p -r1.18 blog.test --- modules/blog/blog.test 22 Aug 2009 00:58:52 -0000 1.18 +++ modules/blog/blog.test 10 Sep 2009 13:29:08 -0000 @@ -138,29 +138,29 @@ class BlogTestCase extends DrupalWebTest // View blog node. $this->drupalGet('node/' . $node->nid); $this->assertResponse(200); - $this->assertTitle($node->title . ' | Drupal', t('Blog node was displayed')); + $this->assertTitle(node_get_title($node) . ' | 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_get_title($node) . ' | 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')); } } Index: modules/book/book.admin.inc =================================================================== RCS file: /cvs/drupal/drupal/modules/book/book.admin.inc,v retrieving revision 1.21 diff -u -p -r1.21 book.admin.inc --- modules/book/book.admin.inc 22 Aug 2009 14:34:18 -0000 1.21 +++ modules/book/book.admin.inc 10 Sep 2009 13:29:08 -0000 @@ -78,7 +78,7 @@ function book_admin_settings_validate($f * @ingroup forms. */ function book_admin_edit($form_state, $node) { - drupal_set_title($node->title); + drupal_set_title(node_get_title($node)); $form = array(); $form['#node'] = $node; _book_admin_table($node, $form); @@ -132,17 +132,19 @@ function book_admin_edit_submit($form, & // 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_get_title($node), '%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_get_title($node)), 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' => node_get_title($form['#node'])))); } /** Index: modules/book/book.module =================================================================== RCS file: /cvs/drupal/drupal/modules/book/book.module,v retrieving revision 1.513 diff -u -p -r1.513 book.module --- modules/book/book.module 10 Sep 2009 12:33:43 -0000 1.513 +++ modules/book/book.module 10 Sep 2009 13:29:08 -0000 @@ -473,7 +473,7 @@ function _book_add_form_elements(&$form, 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_get_title($node); } else { foreach (book_get_books() as $book) { @@ -522,7 +522,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_get_title($node); $node->book['parent_mismatch'] = FALSE; // The normal case. if ($node->book['bid'] == $node->nid) { @@ -878,7 +878,7 @@ function book_form_node_delete_confirm_a if (isset($node->book) && $node->book['has_children']) { $form['book_warning'] = array( - '#markup' => '

' . 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)) . '

', + '#markup' => '

' . 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_get_title($node))) . '

', '#weight' => -10, ); } @@ -1078,7 +1078,7 @@ function book_node_export($node, $childr */ 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(node_get_title($variables['node'])); $variables['content'] = $variables['node']->rendered; } Index: modules/book/book.pages.inc =================================================================== RCS file: /cvs/drupal/drupal/modules/book/book.pages.inc,v retrieving revision 1.15 diff -u -p -r1.15 book.pages.inc --- modules/book/book.pages.inc 17 Aug 2009 07:12:15 -0000 1.15 +++ modules/book/book.pages.inc 10 Sep 2009 13:29:08 -0000 @@ -79,7 +79,7 @@ function book_export_html($nid) { $contents = book_export_traverse($tree, 'book_node_export'); } - return theme('book_export_html', $node->title, $contents, $node->book['depth']); + return theme('book_export_html', node_get_title($node), $contents, $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_get_title($node)); return drupal_get_form('book_outline_form', $node); } @@ -188,7 +188,7 @@ function book_outline_form_submit($form, */ function book_remove_form(&$form_state, $node) { $form['#node'] = $node; - $title = array('%title' => $node->title); + $title = array('%title' => node_get_title($node)); 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); Index: modules/book/book.test =================================================================== RCS file: /cvs/drupal/drupal/modules/book/book.test,v retrieving revision 1.16 diff -u -p -r1.16 book.test --- modules/book/book.test 24 Aug 2009 01:49:41 -0000 1.16 +++ modules/book/book.test 10 Sep 2009 14:47:01 -0000 @@ -110,7 +110,7 @@ class BookTestCase extends DrupalWebTest // 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('‹ ' . node_get_title($previous), '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 DrupalWebTest } 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(node_get_title($next) . ' ›', '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 DrupalWebTest // Check printer friendly version. $this->drupalGet('book/export/html/' . $node->nid); - $this->assertText($node->title, t('Printer friendly title found.')); + $this->assertText(node_get_title($node), 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 DrupalWebTest function generateOutlinePattern($nodes) { $outline = ''; foreach ($nodes as $node) { - $outline .= '(node\/' . $node->nid . ')(.*?)(' . $node->title . ')(.*?)'; + $outline .= '(node\/' . $node->nid . ')(.*?)(' . node_get_title($node) . ')(.*?)'; } return '/
/s'; @@ -172,8 +172,8 @@ class BookTestCase extends DrupalWebTest 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 DrupalWebTest } // 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++; Index: modules/comment/comment.pages.inc =================================================================== RCS file: /cvs/drupal/drupal/modules/comment/comment.pages.inc,v retrieving revision 1.25 diff -u -p -r1.25 comment.pages.inc --- modules/comment/comment.pages.inc 11 Sep 2009 13:37:52 -0000 1.25 +++ modules/comment/comment.pages.inc 11 Sep 2009 16:42:36 -0000 @@ -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_get_title($node), 'node/' . $node->nid))); $op = isset($_POST['op']) ? $_POST['op'] : ''; $build = array(); Index: modules/comment/comment.tokens.inc =================================================================== RCS file: /cvs/drupal/drupal/modules/comment/comment.tokens.inc,v retrieving revision 1.1 diff -u -p -r1.1 comment.tokens.inc --- modules/comment/comment.tokens.inc 19 Aug 2009 20:19:36 -0000 1.1 +++ modules/comment/comment.tokens.inc 10 Sep 2009 13:29:08 -0000 @@ -205,7 +205,8 @@ function comment_tokens($type, $tokens, case 'node': $node = node_load($comment->nid); - $replacements[$original] = $sanitize ? filter_xss($node->title) : $node->title; + $title = node_get_title($node); + $replacements[$original] = $sanitize ? filter_xss($title) : $title; break; } } Index: modules/dblog/dblog.test =================================================================== RCS file: /cvs/drupal/drupal/modules/dblog/dblog.test,v retrieving revision 1.28 diff -u -p -r1.28 dblog.test --- modules/dblog/dblog.test 22 Aug 2009 00:58:52 -0000 1.28 +++ modules/dblog/dblog.test 10 Sep 2009 13:29:08 -0000 @@ -266,7 +266,8 @@ class DBLogTestCase extends DrupalWebTes // 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 DrupalWebTes * @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; Index: modules/file/tests/file.test =================================================================== RCS file: /cvs/drupal/drupal/modules/file/tests/file.test,v retrieving revision 1.1 diff -u -p -r1.1 file.test --- modules/file/tests/file.test 29 Aug 2009 12:52:32 -0000 1.1 +++ modules/file/tests/file.test 10 Sep 2009 13:29:08 -0000 @@ -87,8 +87,9 @@ class FileFieldTestCase extends DrupalWe * 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 $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 $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.')); Index: modules/filter/filter.test =================================================================== RCS file: /cvs/drupal/drupal/modules/filter/filter.test,v retrieving revision 1.40 diff -u -p -r1.40 filter.test --- modules/filter/filter.test 11 Sep 2009 15:39:48 -0000 1.40 +++ modules/filter/filter.test 11 Sep 2009 16:42:36 -0000 @@ -110,14 +110,14 @@ class FilterAdminTestCase extends Drupal $extra_text = 'text'; $edit = array(); - $edit['title'] = $this->randomName(); $langcode = FIELD_LANGUAGE_NONE; + $edit["title[$langcode][0][value]"] = $this->randomName(); $edit["body[$langcode][0][value]"] = $body . '' . $extra_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); Index: modules/forum/forum.module =================================================================== RCS file: /cvs/drupal/drupal/modules/forum/forum.module,v retrieving revision 1.517 diff -u -p -r1.517 forum.module --- modules/forum/forum.module 11 Sep 2009 15:39:48 -0000 1.517 +++ modules/forum/forum.module 11 Sep 2009 16:41:41 -0000 @@ -539,12 +539,12 @@ function forum_block_view($delta = '') { } $cache_keys = array_merge(array('forum', $delta), drupal_render_cid_parts()); - // Cache based on the altered query. Enables us to cache with node access enabled. - $query->preExecute(); - $cache_keys[] = md5(serialize(array((string) $query, $query->getArguments()))); + // Cache based on the altered query. Enables us to cache with node access enabled. + $query->preExecute(); + $cache_keys[] = md5(serialize(array((string) $query, $query->getArguments()))); - $block['subject'] = $title; - $block['content'] = array( + $block['subject'] = $title; + $block['content'] = array( '#access' => user_access('access content'), '#pre_render' => array('forum_block_view_pre_render'), '#cache' => array( @@ -552,8 +552,8 @@ function forum_block_view($delta = '') { 'expire' => CACHE_TEMPORARY, ), '#query' => $query, - ); - return $block; + ); + return $block; } /** @@ -578,7 +578,6 @@ function forum_block_view_pre_render($el */ 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)) { $vid = variable_get('forum_nav_vocabulary', 0); Index: modules/forum/forum.test =================================================================== RCS file: /cvs/drupal/drupal/modules/forum/forum.test,v retrieving revision 1.29 diff -u -p -r1.29 forum.test --- modules/forum/forum.test 25 Aug 2009 21:53:47 -0000 1.29 +++ modules/forum/forum.test 10 Sep 2009 13:29:08 -0000 @@ -234,7 +234,7 @@ class ForumTestCase extends DrupalWebTes $langcode = FIELD_LANGUAGE_NONE; $edit = array( - 'title' => $title, + "title[$langcode][0][value]" => $title, "body[$langcode][0][value]" => $body, 'taxonomy[1]' => $tid ); @@ -308,26 +308,26 @@ class ForumTestCase extends DrupalWebTes // View forum node. $this->drupalGet('node/' . $node->nid); $this->assertResponse(200); - $this->assertTitle($node->title . ' | Drupal', t('Forum node was displayed')); + $this->assertTitle(node_get_title($node) . ' | 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_get_title($node) . ' | 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); $edit['taxonomy[1]'] = $this->root_forum['tid']; // Assumes the topic is initially associated with $forum. $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( @@ -339,7 +339,7 @@ class ForumTestCase extends DrupalWebTes // 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')); } } Index: modules/locale/locale.test =================================================================== RCS file: /cvs/drupal/drupal/modules/locale/locale.test,v retrieving revision 1.40 diff -u -p -r1.40 locale.test --- modules/locale/locale.test 28 Aug 2009 14:40:12 -0000 1.40 +++ modules/locale/locale.test 10 Sep 2009 13:29:08 -0000 @@ -1272,11 +1272,11 @@ class LocalePathFunctionalTest extends D // Confirm English language path alias works. $this->drupalGet($english_path); - $this->assertText($node->title, t('English alias works.')); + $this->assertText(node_get_title($node), 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_get_title($node), t('Custom language alias works.')); $this->drupalLogout(); } @@ -1388,7 +1388,7 @@ class LocaleContentFunctionalTest extend $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, ); Index: modules/menu/menu.module =================================================================== RCS file: /cvs/drupal/drupal/modules/menu/menu.module,v retrieving revision 1.203 diff -u -p -r1.203 menu.module --- modules/menu/menu.module 5 Sep 2009 15:05:03 -0000 1.203 +++ modules/menu/menu.module 10 Sep 2009 13:29:08 -0000 @@ -313,7 +313,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_get_title($node)); } if (!menu_link_save($item)) { drupal_set_message(t('There was an error saving the menu link.'), 'error'); @@ -335,7 +335,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_get_title($node)); } if (!menu_link_save($item)) { drupal_set_message(t('There was an error saving the menu link.'), 'error'); Index: modules/menu/menu.test =================================================================== RCS file: /cvs/drupal/drupal/modules/menu/menu.test,v retrieving revision 1.20 diff -u -p -r1.20 menu.test --- modules/menu/menu.test 21 Aug 2009 14:27:44 -0000 1.20 +++ modules/menu/menu.test 10 Sep 2009 13:29:08 -0000 @@ -280,7 +280,7 @@ class MenuTestCase extends DrupalWebTest // Verify menu link link. $this->clickLink($title); - $title = $parent_node->title; + $title = node_get_title($parent_node); $this->assertTitle(t("@title | Drupal", array('@title' => $title)), t('Parent menu link link target was correct')); } @@ -290,7 +290,7 @@ class MenuTestCase extends DrupalWebTest // Verify menu link link. $this->clickLink($title); - $title = $item_node->title; + $title = node_get_title($item_node); $this->assertTitle(t("@title | Drupal", array('@title' => $title)), t('Menu link link target was correct')); } Index: modules/node/node.admin.inc =================================================================== RCS file: /cvs/drupal/drupal/modules/node/node.admin.inc,v retrieving revision 1.65 diff -u -p -r1.65 node.admin.inc --- modules/node/node.admin.inc 5 Sep 2009 06:53:01 -0000 1.65 +++ modules/node/node.admin.inc 10 Sep 2009 13:29:07 -0000 @@ -335,7 +335,7 @@ function _node_mass_update_batch_process $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_get_title($node), 'node/' . $node->nid); // Update our progress information. $context['sandbox']['progress']++; Index: modules/node/node.install =================================================================== RCS file: /cvs/drupal/drupal/modules/node/node.install,v retrieving revision 1.29 diff -u -p -r1.29 node.install --- modules/node/node.install 31 Aug 2009 16:24:15 -0000 1.29 +++ modules/node/node.install 10 Sep 2009 13:29:08 -0000 @@ -450,9 +450,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); } } @@ -497,6 +497,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; } Index: modules/node/node.module =================================================================== RCS file: /cvs/drupal/drupal/modules/node/node.module,v retrieving revision 1.1122 diff -u -p -r1.1122 node.module --- modules/node/node.module 11 Sep 2009 04:06:39 -0000 1.1122 +++ modules/node/node.module 11 Sep 2009 16:42:36 -0000 @@ -233,25 +233,6 @@ function node_field_build_modes($obj_typ } /** - * 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 @@ -579,7 +560,51 @@ function node_configure_fields($type) { elseif (!empty($instance)) { 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); + } + } } /** @@ -898,6 +923,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); @@ -922,6 +955,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'). @@ -1089,7 +1125,7 @@ function node_build_content($node, $buil $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_get_title($node))) ); } $node->content['links']['node'] = array( @@ -1117,7 +1153,7 @@ function node_build_content($node, $buil */ 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_get_title($node), '%date' => format_date($node->revision_timestamp))), PASS_THROUGH); } // Update the history table, stating that this user viewed this node. @@ -1148,12 +1184,12 @@ function template_preprocess_node(&$vari $variables['node'] = $variables['elements']['#node']; $node = $variables['node']; - $variables['date'] = format_date($node->created); - $variables['name'] = theme('username', $node); - $variables['node_url'] = url('node/' . $node->nid); - $variables['title'] = check_plain($node->title); - $variables['page'] = (bool)menu_get_object(); - + $variables['date'] = format_date($node->created); + $variables['name'] = theme('username', $node); + $variables['node_url'] = url('node/' . $node->nid); + $variables['node_title'] = check_plain(node_get_title($node)); + $variables['page'] = (bool)menu_get_object(); + if (!empty($node->in_preview)) { unset($node->content['links']); } @@ -1168,7 +1204,11 @@ function template_preprocess_node(&$vari // 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; @@ -1397,7 +1437,7 @@ function node_search_execute($keys = NUL $results[] = array( 'link' => url('node/' . $item->sid, array('absolute' => TRUE)), 'type' => check_plain(node_type_get_name($node)), - 'title' => $node->title, + 'title' => node_get_title($node), 'user' => theme('username', $node), 'date' => $node->changed, 'node' => $node, @@ -1673,8 +1713,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', @@ -1753,6 +1791,14 @@ function node_page_title($node) { return $node->title; } + /** + * Return the proper node title translation according to the current language. + */ + function node_get_title($node) { + $langcode = FIELD_LANGUAGE_NONE; + return (isset($node->title[$langcode][0]['value'])) ? $node->title[$langcode][0]['value'] : NULL; + } + /** * Implement hook_init(). */ @@ -1855,7 +1901,7 @@ function node_feed($nids = FALSE, $chann $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_get_title($node), $node->link, $item_text, $node->rss_elements); } $channel_defaults = array( @@ -1956,8 +2002,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; } /** @@ -1990,7 +2039,7 @@ function _node_index_node($node) { node_build_content($node, 'search_index'); $node->rendered = drupal_render($node->content); - $text = '

' . check_plain($node->title) . '

' . $node->rendered; + $text = '

' . check_plain(node_get_title($node)) . '

' . $node->rendered; // Fetch extra data normally not visible $extra = module_invoke_all('node_update_index', $node); @@ -2785,23 +2834,8 @@ function _node_access_rebuild_batch_fini * Implement hook_form(). */ function node_content_form($node, $form_state) { - - $type = node_type_get_type($node); - - $form = array(); - - 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; + // node_overview_types() list content types only if they implement this hook. + return array(); } /** @@ -2950,7 +2984,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_get_title($node))); } /** @@ -2959,7 +2993,7 @@ function node_publish_action($node, $con */ 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_get_title($node))); } /** @@ -2968,7 +3002,7 @@ function node_unpublish_action($node, $c */ 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_get_title($node))); } /** @@ -2977,7 +3011,7 @@ function node_make_sticky_action($node, */ 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_get_title($node))); } /** @@ -2986,7 +3020,7 @@ function node_make_unsticky_action($node */ 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_get_title($node))); } /** @@ -2995,7 +3029,7 @@ function node_promote_action($node, $con */ 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_get_title($node))); } /** @@ -3004,7 +3038,7 @@ function node_unpromote_action($node, $c */ 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_get_title($node))); } /** @@ -3014,7 +3048,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_get_title($node), '%name' => $owner_name)); } function node_assign_owner_action_form($context) { @@ -3095,7 +3129,7 @@ function node_unpublish_by_keyword_actio 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_get_title($node))); break; } } Index: modules/node/node.pages.inc =================================================================== RCS file: /cvs/drupal/drupal/modules/node/node.pages.inc,v retrieving revision 1.79 diff -u -p -r1.79 node.pages.inc --- modules/node/node.pages.inc 5 Sep 2009 15:05:03 -0000 1.79 +++ modules/node/node.pages.inc 10 Sep 2009 13:29:08 -0000 @@ -12,7 +12,7 @@ */ function node_page_edit($node) { $type_name = node_type_get_name($node); - drupal_set_title(t('Edit @type @title', array('@type' => $type_name, '@title' => $node->title)), PASS_THROUGH); + drupal_set_title(t('Edit @type @title', array('@type' => $type_name, '@title' => node_get_title($node))), PASS_THROUGH); return drupal_get_form($node->type . '_node_form', $node); } @@ -151,9 +151,6 @@ function node_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; @@ -410,8 +407,8 @@ function node_form_submit($form, &$form_ $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_get_title($node)); + $t_args = array('@type' => node_type_get_name($node), '%title' => node_get_title($node)); if ($insert) { watchdog('content', '@type: added %title.', $watchdog_args, WATCHDOG_NOTICE, $node_link); @@ -460,7 +457,7 @@ function node_delete_confirm(&$form_stat ); 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_get_title($node))), isset($_GET['destination']) ? $_GET['destination'] : 'node/' . $node->nid, t('This action cannot be undone.'), t('Delete'), @@ -475,8 +472,8 @@ function node_delete_confirm_submit($for 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_get_title($node))); + drupal_set_message(t('@type %title has been deleted.', array('@type' => node_type_get_name($node), '%title' => node_get_title($node)))); } $form_state['redirect'] = ''; @@ -486,7 +483,7 @@ function node_delete_confirm_submit($for * 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_get_title($node))), PASS_THROUGH); $header = array(t('Revision'), array('data' => t('Operations'), 'colspan' => 2)); @@ -551,8 +548,8 @@ function node_revision_revert_confirm_su 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_get_title($node_revision), '%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_get_title($node_revision), '%revision-date' => format_date($node_revision->revision_timestamp)))); $form_state['redirect'] = 'node/' . $node_revision->nid . '/revisions'; } @@ -569,8 +566,8 @@ function node_revision_delete_confirm_su ->execute(); module_invoke_all('node_delete_revision', $node_revision); field_attach_delete_revision('node', $node_revision); - 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_get_title($node_revision), '%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_get_title($node_revision)))); $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'; Index: modules/node/node.test =================================================================== RCS file: /cvs/drupal/drupal/modules/node/node.test,v retrieving revision 1.43 diff -u -p -r1.43 node.test --- modules/node/node.test 29 Aug 2009 04:16:15 -0000 1.43 +++ modules/node/node.test 10 Sep 2009 14:48:28 -0000 @@ -31,15 +31,15 @@ class NodeLoadMultipleUnitTest extends D // 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(node_get_title($node1), t('Node title appears on the default listing.')); + $this->assertText(node_get_title($node2), t('Node title appears on the default listing.')); + $this->assertNoText(node_get_title($node3), t('Node title does not appear in the default listing.')); + $this->assertNoText(node_get_title($node4), 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(node_get_title($node3), node_get_title($nodes[$node3->nid]), t('Node was loaded.')); + $this->assertEqual(node_get_title($node4), node_get_title($nodes[$node4->nid]), 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 D $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(node_get_title($nodes[$node1->nid]), node_get_title($node1), t('Node successfully loaded.')); + $this->assertEqual(node_get_title($nodes[$node2->nid]), node_get_title($node2), t('Node successfully loaded.')); + $this->assertEqual(node_get_title($nodes[$node3->nid]), node_get_title($node3), 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 D $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(node_get_title($nodes[$node1->nid]), node_get_title($node1), t('Node successfully loaded')); + $this->assertEqual(node_get_title($nodes[$node2->nid]), node_get_title($node2), t('Node successfully loaded')); + $this->assertEqual(node_get_title($nodes[$node3->nid]), node_get_title($node3), 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(node_get_title($nodes[$node3->nid]), node_get_title($node3), t('Node successfully loaded.')); } } @@ -152,7 +152,7 @@ class NodeRevisionsTestCase extends Drup // 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' => node_get_title($nodes[1]), '%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 Drup $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' => node_get_title($nodes[1]))), 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 DrupalWeb */ 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 DrupalWeb // 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 DrupalWeb // 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 Drupal */ 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 Drupal */ 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 Drupa 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.')); } } @@ -445,19 +448,23 @@ class NodeTitleXSSTestCase extends Drupa $web_user = $this->drupalCreateUser(array('create page content', 'edit any page content')); $this->drupalLogin($web_user); - $xss = ''; - + $xss = ''; + + $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 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 +533,13 @@ class NodePostSettingsTestCase extends D // 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 +555,13 @@ class NodePostSettingsTestCase extends D // 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 +799,7 @@ class NodeSaveTestCase extends DrupalWeb $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', @@ -899,7 +906,7 @@ class NodeAdminTestCase extends DrupalWe $node3 = $this->drupalCreateNode(array('type' => 'page')); $this->drupalGet('admin/content'); - $this->assertText($node1->title, t('Node appears on the node administration listing.')); + $this->assertText(node_get_title($node1), t('Node appears on the node administration listing.')); // Filter the node listing by status. $edit = array( @@ -908,8 +915,8 @@ class NodeAdminTestCase extends DrupalWe ); $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(node_get_title($node1), t('Published node appears on the node administration listing.')); + $this->assertNoText(node_get_title($node2), t('Unpublished node does not appear on the node administration listing.')); // Filter the node listing by content type. $edit = array( @@ -919,7 +926,54 @@ class NodeAdminTestCase extends DrupalWe $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(node_get_title($node1), t('Article node appears on the node administration listing.')); + $this->assertNoText(node_get_title($node3), 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 in the + * <title> tag, in the page breadcrumb and node display on comment preview. + */ + 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_get_title($node) .' | 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_get_title($node), '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_get_title($node), 'Node preview title is equal to node title.', 'Node'); } } Index: modules/node/node.tokens.inc =================================================================== RCS file: /cvs/drupal/drupal/modules/node/node.tokens.inc,v retrieving revision 1.2 diff -u -p -r1.2 node.tokens.inc --- modules/node/node.tokens.inc 23 Aug 2009 13:02:38 -0000 1.2 +++ modules/node/node.tokens.inc 10 Sep 2009 13:29:08 -0000 @@ -134,7 +134,7 @@ function node_tokens($type, $tokens, arr break; case 'title': - $replacements[$original] = $sanitize ? check_plain($node->title) : $node->title; + $replacements[$original] = $sanitize ? check_plain(node_get_title($node)) : node_get_title($node); break; case 'body': Index: modules/node/node.tpl.php =================================================================== RCS file: /cvs/drupal/drupal/modules/node/node.tpl.php,v retrieving revision 1.22 diff -u -p -r1.22 node.tpl.php --- modules/node/node.tpl.php 11 Sep 2009 06:48:03 -0000 1.22 +++ modules/node/node.tpl.php 11 Sep 2009 16:38:23 -0000 @@ -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'])): ?> Index: modules/path/path.test =================================================================== RCS file: /cvs/drupal/drupal/modules/path/path.test,v retrieving revision 1.20 diff -u -p -r1.20 path.test --- modules/path/path.test 28 Aug 2009 14:40:12 -0000 1.20 +++ modules/path/path.test 10 Sep 2009 13:29:08 -0000 @@ -66,7 +66,7 @@ class PathTestCase extends DrupalWebTest // Confirm that the alias works. $this->drupalGet($edit['dst']); - $this->assertText($node1->title, 'Alias works.'); + $this->assertText(node_get_title($node1), 'Alias works.'); // Change alias. $pid = $this->getPID($edit['dst']); @@ -77,7 +77,7 @@ class PathTestCase extends DrupalWebTest // Confirm that the alias works. $this->drupalGet($edit['dst']); - $this->assertText($node1->title, 'Changed alias works.'); + $this->assertText(node_get_title($node1), 'Changed alias works.'); // Confirm that previous alias no longer works. $this->drupalGet($previous); @@ -117,7 +117,7 @@ class PathTestCase extends DrupalWebTest // Confirm that the alias works. $this->drupalGet($edit['path']); - $this->assertText($node1->title, 'Alias works.'); + $this->assertText(node_get_title($node1), 'Alias works.'); // Change alias. $previous = $edit['path']; @@ -126,11 +126,11 @@ class PathTestCase extends DrupalWebTest // Confirm that the alias works. $this->drupalGet($edit['path']); - $this->assertText($node1->title, 'Changed alias works.'); + $this->assertText(node_get_title($node1), '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(node_get_title($node1), 'Previous alias no longer works.'); $this->assertResponse(404); // Create second test node. @@ -206,14 +206,14 @@ class PathLanguageTestCase extends Drupa // Confirm that the alias works. $this->drupalGet($edit['path']); - $this->assertText($english_node->title, 'Alias works.'); + $this->assertText(node_get_title($english_node), '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')); @@ -223,12 +223,12 @@ class PathLanguageTestCase extends Drupa // 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(node_get_title($french_node), 'Alias for French translation works.'); // Confirm that the alias is returned by url(). $languages = language_list(); Index: modules/php/php.test =================================================================== RCS file: /cvs/drupal/drupal/modules/php/php.test,v retrieving revision 1.16 diff -u -p -r1.16 php.test --- modules/php/php.test 28 Aug 2009 16:23:04 -0000 1.16 +++ modules/php/php.test 10 Sep 2009 13:29:08 -0000 @@ -63,7 +63,7 @@ class PHPFilterTestCase extends PHPTestC $langcode = FIELD_LANGUAGE_NONE; $edit["body[$langcode][0][value_format]"] = 3; $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_get_title($node))), 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.')); Index: modules/poll/poll.module =================================================================== RCS file: /cvs/drupal/drupal/modules/poll/poll.module,v retrieving revision 1.312 diff -u -p -r1.312 poll.module --- modules/poll/poll.module 10 Sep 2009 08:43:46 -0000 1.312 +++ modules/poll/poll.module 10 Sep 2009 13:29:08 -0000 @@ -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']; } @@ -706,7 +698,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(node_get_title($form['#node'])); $variables['vote'] = drupal_render($form['vote']); $variables['rest'] = drupal_render_children($form); $variables['block'] = $form['#block']; @@ -738,7 +730,7 @@ function poll_view_results($node, $build } } - return theme('poll_results', $node->title, $poll_results, $total_votes, isset($node->links) ? $node->links : array(), $block, $node->nid, isset($node->vote) ? $node->vote : NULL); + return theme('poll_results', node_get_title($node), $poll_results, $total_votes, isset($node->links) ? $node->links : array(), $block, $node->nid, isset($node->vote) ? $node->vote : NULL); } Index: modules/poll/poll.pages.inc =================================================================== RCS file: /cvs/drupal/drupal/modules/poll/poll.pages.inc,v retrieving revision 1.20 diff -u -p -r1.20 poll.pages.inc --- modules/poll/poll.pages.inc 29 Jul 2009 06:39:34 -0000 1.20 +++ modules/poll/poll.pages.inc 10 Sep 2009 13:29:08 -0000 @@ -51,7 +51,7 @@ function poll_page() { */ function poll_votes($node) { $votes_per_page = 20; - drupal_set_title($node->title); + drupal_set_title(node_get_title($node)); $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_get_title($node)); $node->show_results = TRUE; return node_show($node); } Index: modules/poll/poll.test =================================================================== RCS file: /cvs/drupal/drupal/modules/poll/poll.test,v retrieving revision 1.22 diff -u -p -r1.22 poll.test --- modules/poll/poll.test 17 Aug 2009 07:12:16 -0000 1.22 +++ modules/poll/poll.test 10 Sep 2009 13:29:08 -0000 @@ -57,8 +57,9 @@ class PollTestCase extends DrupalWebTest $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 DrupalWebT $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(), ); Index: modules/search/search.api.php =================================================================== RCS file: /cvs/drupal/drupal/modules/search/search.api.php,v retrieving revision 1.15 diff -u -p -r1.15 search.api.php --- modules/search/search.api.php 10 Sep 2009 12:33:45 -0000 1.15 +++ modules/search/search.api.php 10 Sep 2009 13:29:08 -0000 @@ -192,7 +192,7 @@ function hook_search_execute($keys = NUL $results[] = array( 'link' => url('node/' . $item->sid, array('absolute' => TRUE)), 'type' => check_plain(node_type_get_name($node)), - 'title' => $node->title, + 'title' => node_get_title($node), 'user' => theme('username', $node), 'date' => $node->changed, 'node' => $node, @@ -268,7 +268,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_get_title($node)) . '</h1>' . $node->rendered; // Fetch extra data normally not visible $extra = module_invoke_all('node_update_index', $node); Index: modules/search/search.test =================================================================== RCS file: /cvs/drupal/drupal/modules/search/search.test,v retrieving revision 1.35 diff -u -p -r1.35 search.test --- modules/search/search.test 11 Sep 2009 15:39:48 -0000 1.35 +++ modules/search/search.test 11 Sep 2009 16:42:36 -0000 @@ -280,17 +280,17 @@ class SearchAdvancedSearchForm extends D $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/' . node_get_title($this->node)); + $this->assertText(node_get_title($this->node), 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' => node_get_title($this->node)); $this->drupalPost('search/node', $edit, t('Advanced search')); - $this->assertText($this->node->title, t('Page node is found with POST query.')); + $this->assertText(node_get_title($this->node), 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(node_get_title($this->node), 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 Drup // 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 Drup 'search_theme_form' => $comment_body, ); $this->drupalPost('', $edit, t('Search')); - $this->assertText($node->title, t('Node found in search results.')); + $this->assertText(node_get_title($node), 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.')); Index: modules/simpletest/drupal_web_test_case.php =================================================================== RCS file: /cvs/drupal/drupal/modules/simpletest/drupal_web_test_case.php,v retrieving revision 1.147 diff -u -p -r1.147 drupal_web_test_case.php --- modules/simpletest/drupal_web_test_case.php 5 Sep 2009 13:05:30 -0000 1.147 +++ modules/simpletest/drupal_web_test_case.php 10 Sep 2009 14:54:29 -0000 @@ -694,7 +694,7 @@ class DrupalWebTestCase extends DrupalTe // 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, Index: modules/statistics/statistics.pages.inc =================================================================== RCS file: /cvs/drupal/drupal/modules/statistics/statistics.pages.inc,v retrieving revision 1.16 diff -u -p -r1.16 statistics.pages.inc --- modules/statistics/statistics.pages.inc 25 Aug 2009 10:27:15 -0000 1.16 +++ modules/statistics/statistics.pages.inc 10 Sep 2009 13:29:08 -0000 @@ -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_get_title($node)); $build['statistics_table'] = array( '#theme' => 'table', '#header' => $header, Index: modules/system/system.api.php =================================================================== RCS file: /cvs/drupal/drupal/modules/system/system.api.php,v retrieving revision 1.74 diff -u -p -r1.74 system.api.php --- modules/system/system.api.php 10 Sep 2009 06:38:20 -0000 1.74 +++ modules/system/system.api.php 10 Sep 2009 13:29:08 -0000 @@ -1085,7 +1085,7 @@ function hook_mail($key, &$message, $par '%uid' => $node->uid, '%node_url' => url('node/' . $node->nid, array('absolute' => TRUE)), '%node_type' => node_type_get_name($node), - '%title' => $node->title, + '%title' => node_get_title($node), '%teaser' => $node->teaser, '%body' => $node->body, ); Index: modules/system/system.test =================================================================== RCS file: /cvs/drupal/drupal/modules/system/system.test,v retrieving revision 1.75 diff -u -p -r1.75 system.test --- modules/system/system.test 1 Sep 2009 16:50:12 -0000 1.75 +++ modules/system/system.test 10 Sep 2009 13:29:08 -0000 @@ -539,7 +539,7 @@ class AccessDeniedTestCase extends Drupa $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); @@ -548,13 +548,13 @@ class AccessDeniedTestCase extends Drupa $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_get_title($node), 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_get_title($node), 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. @@ -616,7 +616,7 @@ class PageNotFoundTestCase extends Drupa $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); @@ -625,7 +625,7 @@ class PageNotFoundTestCase extends Drupa $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_get_title($node), t('Found the custom 404 page')); } } @@ -811,16 +811,16 @@ class PageTitleFiltering extends DrupalW // 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.'); } } @@ -1192,7 +1192,7 @@ class TokenReplaceTestCase extends Drupa // 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; $source = '[node:title]'; // Title of the node we passed in @@ -1203,7 +1203,7 @@ class TokenReplaceTestCase extends Drupa $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_get_title($node)); $target .= check_plain($account->name); $target .= format_interval(REQUEST_TIME - $node->created, 2); $target .= check_plain($user->name); @@ -1221,9 +1221,9 @@ class TokenReplaceTestCase extends Drupa $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_get_title($node))), 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_get_title($node)), t('Unsanitized token generated properly.')); } } Index: modules/system/system.tokens.inc =================================================================== RCS file: /cvs/drupal/drupal/modules/system/system.tokens.inc,v retrieving revision 1.2 diff -u -p -r1.2 system.tokens.inc --- modules/system/system.tokens.inc 25 Aug 2009 10:27:15 -0000 1.2 +++ modules/system/system.tokens.inc 10 Sep 2009 13:29:08 -0000 @@ -275,7 +275,7 @@ function system_tokens($type, $tokens, 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_get_title($node)) : node_get_title($node); } break; Index: modules/taxonomy/taxonomy.test =================================================================== RCS file: /cvs/drupal/drupal/modules/taxonomy/taxonomy.test,v retrieving revision 1.46 diff -u -p -r1.46 taxonomy.test --- modules/taxonomy/taxonomy.test 25 Aug 2009 21:53:48 -0000 1.46 +++ modules/taxonomy/taxonomy.test 10 Sep 2009 13:29:08 -0000 @@ -451,14 +451,14 @@ class TaxonomyTermTestCase extends Taxon // 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['taxonomy[' . $this->vocabulary->vid . ']'] = $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.')); @@ -491,14 +491,14 @@ class TaxonomyTermTestCase extends Taxon $this->randomName(), ); $edit = array(); - $edit['title'] = $this->randomName(); + $langcode = FIELD_LANGUAGE_NONE; + $edit["title[$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['taxonomy[tags][' . $this->vocabulary->vid . ']'] = implode(', ', $terms); - $langcode = FIELD_LANGUAGE_NONE; $edit["body[$langcode][0][value]"] = $this->randomName(); $this->drupalPost('node/add/article', $edit, t('Save')); - $this->assertRaw(t('@type %title has been created.', array('@type' => t('Article'), '%title' => $edit['title'])), t('The node was created successfully')); + $this->assertRaw(t('@type %title has been created.', array('@type' => t('Article'), '%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')); } Index: modules/tracker/tracker.test =================================================================== RCS file: /cvs/drupal/drupal/modules/tracker/tracker.test,v retrieving revision 1.11 diff -u -p -r1.11 tracker.test --- modules/tracker/tracker.test 31 Aug 2009 06:52:50 -0000 1.11 +++ modules/tracker/tracker.test 10 Sep 2009 13:29:08 -0000 @@ -32,17 +32,17 @@ class TrackerTest extends DrupalWebTestC $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(node_get_title($unpublished), t('Unpublished node do not show up in the tracker listing.')); + $this->assertText(node_get_title($published), 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 DrupalWebTestC $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 DrupalWebTestC $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(node_get_title($unpublished), t("Unpublished nodes do not show up in the users's tracker listing.")); + $this->assertText(node_get_title($my_published), t("Published nodes show up in the user's tracker listing.")); + $this->assertNoText(node_get_title($other_published_no_comment), t("Other user's nodes do not show up in the user's tracker listing.")); + $this->assertText(node_get_title($other_published_my_comment), t("Nodes that the user has commented on appear in the user's tracker listing.")); } /** @@ -92,24 +92,25 @@ class TrackerTest extends DrupalWebTestC $this->drupalLogin($this->user); $edit = array( - 'title' => $this->randomName(), + 'title' => array(FIELD_LANGUAGE_NONE => array(array('value' => $this->randomName(8)))), ); + $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 DrupalWebTestC $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 DrupalWebTestC 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 DrupalWebTestC // 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_get_title($node), 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 DrupalWebTestC // 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_get_title($node), 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 DrupalWebTestC $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_get_title($node), t('Node is displayed on the tracker listing pages.')); // Unpublish the node and ensure that it's no longer displayed. $edit = array( Index: modules/translation/translation.module =================================================================== RCS file: /cvs/drupal/drupal/modules/translation/translation.module,v retrieving revision 1.60 diff -u -p -r1.60 translation.module --- modules/translation/translation.module 10 Sep 2009 06:32:54 -0000 1.60 +++ modules/translation/translation.module 10 Sep 2009 13:29:08 -0000 @@ -208,7 +208,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' => node_get_title($source_node), '%language' => $languages[$language]->name, '%type' => $node->type)), 'error'); return; } } Index: modules/translation/translation.pages.inc =================================================================== RCS file: /cvs/drupal/drupal/modules/translation/translation.pages.inc,v retrieving revision 1.8 diff -u -p -r1.8 translation.pages.inc --- modules/translation/translation.pages.inc 29 Jul 2009 06:39:35 -0000 1.8 +++ modules/translation/translation.pages.inc 10 Sep 2009 13:29:08 -0000 @@ -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(node_get_title($translation_node), '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_get_title($node))), PASS_THROUGH); $build['translation_node_overview'] = array( '#theme' => 'table', Index: modules/translation/translation.test =================================================================== RCS file: /cvs/drupal/drupal/modules/translation/translation.test,v retrieving revision 1.17 diff -u -p -r1.17 translation.test --- modules/translation/translation.test 22 Aug 2009 00:58:55 -0000 1.17 +++ modules/translation/translation.test 10 Sep 2009 13:29:08 -0000 @@ -59,11 +59,11 @@ class TranslationTestCase extends Drupal // 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 Drupal */ 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 Drupal $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; Index: modules/trigger/trigger.test =================================================================== RCS file: /cvs/drupal/drupal/modules/trigger/trigger.test,v retrieving revision 1.17 diff -u -p -r1.17 trigger.test --- modules/trigger/trigger.test 1 Sep 2009 16:50:12 -0000 1.17 +++ modules/trigger/trigger.test 10 Sep 2009 13:29:08 -0000 @@ -37,15 +37,15 @@ class TriggerContentTestCase extends Dru $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 Index: modules/upload/upload.test =================================================================== RCS file: /cvs/drupal/drupal/modules/upload/upload.test,v retrieving revision 1.26 diff -u -p -r1.26 upload.test --- modules/upload/upload.test 31 Aug 2009 05:47:34 -0000 1.26 +++ modules/upload/upload.test 10 Sep 2009 13:29:08 -0000 @@ -74,7 +74,7 @@ class UploadTestCase extends DrupalWebTe $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_get_title($node))), '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 DrupalWebTe $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_get_title($node))), 'File deleted successfully.'); $this->assertNoText($new_name, $new_name . ' not found on node.'); $uri = 'public://' . $upload->description; @@ -197,7 +197,7 @@ class UploadTestCase extends DrupalWebTe $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_get_title($node))), 'File attached successfully.'); } } Index: themes/garland/node.tpl.php =================================================================== RCS file: /cvs/drupal/drupal/themes/garland/node.tpl.php,v retrieving revision 1.16 diff -u -p -r1.16 node.tpl.php --- themes/garland/node.tpl.php 11 Sep 2009 06:48:03 -0000 1.16 +++ themes/garland/node.tpl.php 11 Sep 2009 16:37:42 -0000 @@ -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): ?>