=== modified file 'modules/aggregator/aggregator.test' --- modules/aggregator/aggregator.test 2009-12-02 19:26:21 +0000 +++ modules/aggregator/aggregator.test 2010-01-08 20:30:07 +0000 @@ -253,7 +253,7 @@ EOF; // Post 5 articles. for ($i = 0; $i < 5; $i++) { $edit = array(); - $edit["title[$langcode][0][value]"] = $this->randomName(); + $edit['title'] = $this->randomName(); $edit["body[$langcode][0][value]"] = $this->randomName(); $this->drupalPost('node/add/article', $edit, t('Save')); } === modified file 'modules/blog/blog.test' --- modules/blog/blog.test 2009-12-03 20:21:50 +0000 +++ modules/blog/blog.test 2010-01-08 20:30:07 +0000 @@ -138,29 +138,29 @@ class BlogTestCase extends DrupalWebTest // View blog node. $this->drupalGet('node/' . $node->nid); $this->assertResponse(200); - $this->assertTitle($node->title[LANGUAGE_NONE][0]['value'] . ' | Drupal', t('Blog node was displayed')); + $this->assertTitle($node->title . ' | Drupal', t('Blog node was displayed')); $this->assertText(t('Home ' . $crumb . ' Blogs ' . $crumb . ' @name' . $quote . 's blog', array('@name' => format_username($node_user))), 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[LANGUAGE_NONE][0]['value'] . ' | Drupal', t('Blog edit node was displayed')); + $this->assertTitle('Edit Blog entry ' . $node->title . ' | Drupal', t('Blog edit node was displayed')); } if ($response == 200) { // Edit blog node. $edit = array(); $langcode = LANGUAGE_NONE; - $edit["title[$langcode][0][value]"] = 'node/' . $node->nid; + $edit["title"] = '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[$langcode][0][value]"])), t('Blog node was edited')); + $this->assertRaw(t('Blog entry %title has been updated.', array('%title' => $edit["title"])), 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[$langcode][0][value]"])), t('Blog node was deleted')); + $this->assertRaw(t('Blog entry %title has been deleted.', array('%title' => $edit["title"])), t('Blog node was deleted')); } } === modified file 'modules/book/book.admin.inc' --- modules/book/book.admin.inc 2010-01-07 20:02:08 +0000 +++ modules/book/book.admin.inc 2010-01-08 20:30:07 +0000 @@ -72,7 +72,7 @@ function book_admin_settings_validate($f * @ingroup forms. */ function book_admin_edit($form, $form_state, $node) { - drupal_set_title($node->title[LANGUAGE_NONE][0]['value']); + drupal_set_title($node->title); $form['#node'] = $node; _book_admin_table($node, $form); $form['save'] = array( @@ -126,18 +126,18 @@ function book_admin_edit_submit($form, & if ($row['title']['#default_value'] != $values['title']) { $node = node_load($values['nid'], FALSE); $langcode = LANGUAGE_NONE; - $node->title = array($langcode => array(array('value' => $values['title']))); + $node->title = $values['title']; $node->book['link_title'] = $values['title']; $node->revision = 1; - $node->log = t('Title changed from %original to %current.', array('%original' => $node->title[$langcode][0]['value'], '%current' => $values['title'])); + $node->log = t('Title changed from %original to %current.', array('%original' => $node->title, '%current' => $values['title'])); node_save($node); - watchdog('content', 'book: updated %title.', array('%title' => $node->title[$langcode][0]['value']), WATCHDOG_NOTICE, l(t('view'), 'node/' . $node->nid)); + watchdog('content', 'book: updated %title.', array('%title' => $node->title), WATCHDOG_NOTICE, l(t('view'), 'node/' . $node->nid)); } } } - drupal_set_message(t('Updated book %title.', array('%title' => $form['#node']->title[$langcode][0]['value']))); + drupal_set_message(t('Updated book %title.', array('%title' => $form['#node']->title))); } /** === modified file 'modules/book/book.module' --- modules/book/book.module 2010-01-08 07:36:53 +0000 +++ modules/book/book.module 2010-01-08 20:30:07 +0000 @@ -511,7 +511,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[LANGUAGE_NONE][0]['value']; + $options[$node->nid] = $node->title; } else { foreach (book_get_books() as $book) { @@ -560,7 +560,7 @@ function _book_update_outline($node) { $new = empty($node->book['mlid']); $node->book['link_path'] = 'node/' . $node->nid; - $node->book['link_title'] = $node->title[LANGUAGE_NONE][0]['value']; + $node->book['link_title'] = $node->title; $node->book['parent_mismatch'] = FALSE; // The normal case. if ($node->book['bid'] == $node->nid) { @@ -916,7 +916,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[LANGUAGE_NONE][0]['value'])) . '

', + '#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)) . '

', '#weight' => -10, ); } @@ -1139,7 +1139,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[LANGUAGE_NONE][0]['value']); + $variables['title'] = check_plain($variables['node']->title); $variables['content'] = $variables['node']->rendered; } === modified file 'modules/book/book.pages.inc' --- modules/book/book.pages.inc 2009-12-02 19:26:21 +0000 +++ modules/book/book.pages.inc 2010-01-08 20:30:07 +0000 @@ -79,7 +79,7 @@ function book_export_html($nid) { $contents = book_export_traverse($tree, 'book_node_export'); } - return theme('book_export_html', array('title' => $node->title[LANGUAGE_NONE][0]['value'], 'contents' => $contents, 'depth' => $node->book['depth'])); + return theme('book_export_html', array('title' => $node->title, 'contents' => $contents, 'depth' => $node->book['depth'])); } else { drupal_access_denied(); @@ -90,7 +90,7 @@ function book_export_html($nid) { * Menu callback; show the outline form for a single node. */ function book_outline($node) { - drupal_set_title($node->title[LANGUAGE_NONE][0]['value']); + drupal_set_title($node->title); return drupal_get_form('book_outline_form', $node); } @@ -188,7 +188,7 @@ function book_outline_form_submit($form, */ function book_remove_form($form, &$form_state, $node) { $form['#node'] = $node; - $title = array('%title' => $node->title[LANGUAGE_NONE][0]['value']); + $title = array('%title' => $node->title); 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); === modified file 'modules/book/book.test' --- modules/book/book.test 2009-12-02 19:26:21 +0000 +++ modules/book/book.test 2010-01-08 20:30:07 +0000 @@ -110,7 +110,7 @@ class BookTestCase extends DrupalWebTest // Check previous, up, and next links. if ($previous) { - $this->assertRaw(l('‹ ' . $previous->title[LANGUAGE_NONE][0]['value'], 'node/' . $previous->nid, array('attributes' => array('class' => array('page-previous'), 'title' => t('Go to previous page')))), t('Previous page link found.')); + $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.')); } if ($up) { @@ -118,7 +118,7 @@ class BookTestCase extends DrupalWebTest } if ($next) { - $this->assertRaw(l($next->title[LANGUAGE_NONE][0]['value'] . ' ›', 'node/' . $next->nid, array('attributes' => array('class' => array('page-next'), 'title' => t('Go to next page')))), t('Next page link found.')); + $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.')); } // 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[LANGUAGE_NONE][0]['value'], t('Printer friendly title found.')); + $this->assertText($node->title, t('Printer friendly title found.')); $this->assertRaw(check_markup($node->body[LANGUAGE_NONE][0]['value'], $node->body[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[LANGUAGE_NONE][0]['value'] . ')(.*?)'; + $outline .= '(node\/' . $node->nid . ')(.*?)(' . $node->title . ')(.*?)'; } return '/
/s'; @@ -173,7 +173,7 @@ class BookTestCase extends DrupalWebTest $edit = array(); $langcode = LANGUAGE_NONE; - $edit["title[$langcode][0][value]"] = $number . ' - SimpleTest test node ' . $this->randomName(10); + $edit["title"] = $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[$langcode][0][value]"]); + $node = $this->drupalGetNodeByTitle($edit['title']); $this->assertNotNull(($node === FALSE ? NULL : $node), t('Book node found in database.')); $number++; === modified file 'modules/comment/comment.pages.inc' --- modules/comment/comment.pages.inc 2010-01-07 05:23:51 +0000 +++ modules/comment/comment.pages.inc 2010-01-08 20:30:07 +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[LANGUAGE_NONE][0]['value'], 'node/' . $node->nid))); + drupal_set_breadcrumb(array(l(t('Home'), NULL), l($node->title, 'node/' . $node->nid))); $op = isset($_POST['op']) ? $_POST['op'] : ''; $build = array(); === modified file 'modules/comment/comment.tokens.inc' --- modules/comment/comment.tokens.inc 2010-01-07 20:55:49 +0000 +++ modules/comment/comment.tokens.inc 2010-01-08 20:30:07 +0000 @@ -210,7 +210,7 @@ function comment_tokens($type, $tokens, case 'node': $node = node_load($comment->nid); - $title = $node->title[LANGUAGE_NONE][0]['value']; + $title = $node->title; $replacements[$original] = $sanitize ? filter_xss($title) : $title; break; } === modified file 'modules/dblog/dblog.test' --- modules/dblog/dblog.test 2009-12-23 23:07:16 +0000 +++ modules/dblog/dblog.test 2010-01-08 20:30:07 +0000 @@ -266,7 +266,7 @@ class DBLogTestCase extends DrupalWebTes // Create node using form to generate add content event (which is not triggered by drupalCreateNode). $edit = $this->getContent($type); $langcode = LANGUAGE_NONE; - $title = $edit["title[$langcode][0][value]"]; + $title = $edit["title"]; $this->drupalPost('node/add/' . $type, $edit, t('Save')); $this->assertResponse(200); // Retrieve node object. @@ -324,7 +324,7 @@ class DBLogTestCase extends DrupalWebTes switch ($type) { case 'poll': $content = array( - "title[$langcode][0][value]" => $this->randomName(8), + "title" => $this->randomName(8), 'choice[new:0][chtext]' => $this->randomName(32), 'choice[new:1][chtext]' => $this->randomName(32), ); @@ -332,7 +332,7 @@ class DBLogTestCase extends DrupalWebTes default: $content = array( - "title[$langcode][0][value]" => $this->randomName(8), + "title" => $this->randomName(8), "body[$langcode][0][value]" => $this->randomName(32), ); break; === modified file 'modules/field/field.api.php' --- modules/field/field.api.php 2010-01-02 15:00:34 +0000 +++ modules/field/field.api.php 2010-01-08 20:30:07 +0000 @@ -1333,7 +1333,7 @@ function hook_field_storage_pre_insert($ foreach ($language as $delta) { $query->values(array( 'nid' => $object->nid, - 'title' => $object->title[LANGUAGE_NONE][0]['value'], + 'title' => $object->title, 'tid' => $delta['value'], 'sticky' => $object->sticky, 'created' => $object->created, === modified file 'modules/file/tests/file.test' --- modules/file/tests/file.test 2009-12-02 19:26:21 +0000 +++ modules/file/tests/file.test 2010-01-08 20:30:07 +0000 @@ -90,7 +90,7 @@ class FileFieldTestCase extends DrupalWe function uploadNodeFile($file, $field_name, $nid_or_type, $new_revision = TRUE) { $langcode = LANGUAGE_NONE; $edit = array( - "title[$langcode][0][value]" => $this->randomName(), + "title" => $this->randomName(), 'revision' => (string) (int) $new_revision, ); @@ -347,7 +347,7 @@ class FileFieldValidateTestCase extends // Try to post a new node without uploading a file. $langcode = LANGUAGE_NONE; - $edit = array("title[$langcode][0][value]" => $this->randomName()); + $edit = array("title" => $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.')); @@ -364,7 +364,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[$langcode][0][value]" => $this->randomName()); + $edit = array('title' => $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.')); === modified file 'modules/filter/filter.test' --- modules/filter/filter.test 2009-12-14 13:32:53 +0000 +++ modules/filter/filter.test 2010-01-08 20:30:07 +0000 @@ -290,13 +290,13 @@ class FilterAdminTestCase extends Drupal $edit = array(); $langcode = LANGUAGE_NONE; - $edit["title[$langcode][0][value]"] = $this->randomName(); + $edit["title"] = $this->randomName(); $edit["body[$langcode][0][value]"] = $text; $edit["body[$langcode][0][value_format]"] = $filtered; $this->drupalPost('node/add/page', $edit, t('Save')); - $this->assertRaw(t('Page %title has been created.', array('%title' => $edit["title[$langcode][0][value]"])), t('Filtered node created.')); + $this->assertRaw(t('Page %title has been created.', array('%title' => $edit["title"])), t('Filtered node created.')); - $node = $this->drupalGetNodeByTitle($edit["title[$langcode][0][value]"]); + $node = $this->drupalGetNodeByTitle($edit["title"]); $this->assertTrue($node, t('Node found in database.')); $this->drupalGet('node/' . $node->nid); === modified file 'modules/forum/forum.module' --- modules/forum/forum.module 2010-01-06 15:19:24 +0000 +++ modules/forum/forum.module 2010-01-08 20:30:07 +0000 @@ -502,7 +502,7 @@ function forum_field_storage_pre_insert( foreach ($language as $item) { $query->values(array( 'nid' => $object->nid, - 'title' => $object->title[LANGUAGE_NONE][0]['value'], + 'title' => $object->title, 'tid' => $item['tid'], 'sticky' => $object->sticky, 'created' => $object->created, @@ -536,7 +536,7 @@ function forum_field_storage_pre_update( foreach ($language as $item) { $query->values(array( 'nid' => $object->nid, - 'title' => $object->title[LANGUAGE_NONE][0]['value'], + 'title' => $object->title, 'tid' => $item['tid'], 'sticky' => $object->sticky, 'created' => $object->created, @@ -677,6 +677,12 @@ 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)) { $forum_terms = $node->taxonomy_forums; === modified file 'modules/forum/forum.test' --- modules/forum/forum.test 2010-01-07 05:23:51 +0000 +++ modules/forum/forum.test 2010-01-08 20:30:07 +0000 @@ -267,7 +267,7 @@ class ForumTestCase extends DrupalWebTes $langcode = LANGUAGE_NONE; $edit = array( - "title[$langcode][0][value]" => $title, + "title" => $title, "body[$langcode][0][value]" => $body, "taxonomy_forums[$langcode]" => $tid, ); @@ -342,27 +342,27 @@ class ForumTestCase extends DrupalWebTes // View forum node. $this->drupalGet('node/' . $node->nid); $this->assertResponse(200); - $this->assertTitle($node->title[LANGUAGE_NONE][0]['value'] . ' | Drupal', t('Forum node was displayed')); + $this->assertTitle($node->title . ' | 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[LANGUAGE_NONE][0]['value'] . ' | Drupal', t('Forum edit node was displayed')); + $this->assertTitle('Edit Forum topic ' . $node->title . ' | Drupal', t('Forum edit node was displayed')); } if ($response == 200) { // Edit forum node (including moving it to another forum). $edit = array(); $langcode = LANGUAGE_NONE; - $edit["title[$langcode][0][value]"] = 'node/' . $node->nid; + $edit["title"] = 'node/' . $node->nid; $edit["body[$langcode][0][value]"] = $this->randomName(256); // Assume the topic is initially associated with $forum. $edit["taxonomy_forums[$langcode]"] = $this->root_forum['tid']; $edit['shadow'] = TRUE; $this->drupalPost('node/' . $node->nid . '/edit', $edit, t('Save')); - $this->assertRaw(t('Forum topic %title has been updated.', array('%title' => $edit["title[$langcode][0][value]"])), t('Forum node was edited')); + $this->assertRaw(t('Forum topic %title has been updated.', array('%title' => $edit["title"])), 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( @@ -374,7 +374,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[$langcode][0][value]"])), t('Forum node was deleted')); + $this->assertRaw(t('Forum topic %title has been deleted.', array('%title' => $edit['title'])), t('Forum node was deleted')); } } === modified file 'modules/locale/locale.test' --- modules/locale/locale.test 2010-01-04 04:53:33 +0000 +++ modules/locale/locale.test 2010-01-08 20:30:07 +0000 @@ -1340,11 +1340,11 @@ class LocalePathFunctionalTest extends D // Confirm English language path alias works. $this->drupalGet($english_path); - $this->assertText($node->title[LANGUAGE_NONE][0]['value'], t('English alias works.')); + $this->assertText($node->title, t('English alias works.')); // Confirm custom language path alias works. $this->drupalGet($prefix . '/' . $custom_language_path); - $this->assertText($node->title[LANGUAGE_NONE][0]['value'], t('Custom language alias works.')); + $this->assertText($node->title, t('Custom language alias works.')); $this->drupalLogout(); } @@ -1451,7 +1451,7 @@ class LocaleContentFunctionalTest extend $node_body = $this->randomName(); $edit = array( 'type' => 'page', - 'title' => array(LANGUAGE_NONE => array(array('value' => $node_title))), + 'title' => $node_title, 'body' => array($langcode => array(array('value' => $node_body))), 'language' => $langcode, ); @@ -1711,7 +1711,7 @@ class LocaleMultilingualFieldsFunctional function testMultilingualNodeForm() { // Create page content. $langcode = LANGUAGE_NONE; - $title_key = "title[$langcode][0][value]"; + $title_key = "title"; $title_value = $this->randomName(8); $body_key = "body[$langcode][0][value]"; $body_value = $this->randomName(16); @@ -1750,7 +1750,7 @@ class LocaleMultilingualFieldsFunctional function testMultilingualDisplaySettings() { // Create page content. $langcode = LANGUAGE_NONE; - $title_key = "title[$langcode][0][value]"; + $title_key = "title"; $title_value = $this->randomName(8); $body_key = "body[$langcode][0][value]"; $body_value = $this->randomName(16); === modified file 'modules/menu/menu.module' --- modules/menu/menu.module 2010-01-08 16:49:54 +0000 +++ modules/menu/menu.module 2010-01-08 20:30:07 +0000 @@ -490,7 +490,7 @@ function menu_node_save($node) { $link['link_path'] = "node/$node->nid"; // If not already set, use the node's title as link title attribute. if (empty($link['options']['attributes']['title']) && !$link['customized']) { - $link['options']['attributes']['title'] = trim($node->title[LANGUAGE_NONE][0]['value']); + $link['options']['attributes']['title'] = trim($node->title); } if (!menu_link_save($link)) { drupal_set_message(t('There was an error saving the menu link.'), 'error'); === modified file 'modules/menu/menu.test' --- modules/menu/menu.test 2010-01-02 19:25:20 +0000 +++ modules/menu/menu.test 2010-01-08 20:30:07 +0000 @@ -317,7 +317,7 @@ class MenuTestCase extends DrupalWebTest // Verify menu link link. $this->clickLink($title); - $title = $parent_node->title[LANGUAGE_NONE][0]['value']; + $title = $parent_node->title; $this->assertTitle(t("@title | Drupal", array('@title' => $title)), t('Parent menu link link target was correct')); } @@ -327,7 +327,7 @@ class MenuTestCase extends DrupalWebTest // Verify menu link link. $this->clickLink($title); - $title = $item_node->title[LANGUAGE_NONE][0]['value']; + $title = $item_node->title; $this->assertTitle(t("@title | Drupal", array('@title' => $title)), t('Menu link link target was correct')); } @@ -557,7 +557,7 @@ class MenuNodeTestCase extends DrupalWeb $node_title = $this->randomName(); $language = LANGUAGE_NONE; $edit = array( - "title[$language][0][value]" => $node_title, + "title" => $node_title, "body[$language][0][value]" => $this->randomString(), ); $this->drupalPost('node/add/page', $edit, t('Save')); === modified file 'modules/node/node.admin.inc' --- modules/node/node.admin.inc 2010-01-08 07:36:53 +0000 +++ modules/node/node.admin.inc 2010-01-08 20:30:07 +0000 @@ -345,7 +345,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[LANGUAGE_NONE][0]['value'], 'node/' . $node->nid); + $context['results'][] = l($node->title, 'node/' . $node->nid); // Update our progress information. $context['sandbox']['progress']++; @@ -470,7 +470,7 @@ function node_admin_nodes() { 'title' => array( 'data' => array( '#type' => 'link', - '#title' => $node->title[LANGUAGE_NONE][0]['value'], + '#title' => $node->title, '#href' => 'node/' . $node->nid, '#options' => $l_options, '#suffix' => ' ' . theme('mark', array('type' => node_mark($node->nid, $node->changed))), === modified file 'modules/node/node.install' --- modules/node/node.install 2009-12-04 16:49:45 +0000 +++ modules/node/node.install 2010-01-08 20:30:07 +0000 @@ -443,9 +443,9 @@ function node_update_7006(&$context) { if (!isset($context['total'])) { // Initial invocation. - // Re-save node types to create title and body field instances. + // Re-save node types to create body field instances. foreach ($node_types as $type => $info) { - if ($info->has_title || $info->has_body) { + if ($info->has_body) { node_type_save($info); } } @@ -490,7 +490,7 @@ function node_update_7006(&$context) { 'vid' => $revision->vid, 'type' => $revision->type, ); - $node->title[LANGUAGE_NONE][0]['value'] = $revision->title; + $node->title = $revision->title; if (!empty($revision->teaser) && $revision->teaser != text_summary($revision->body)) { $node->body[LANGUAGE_NONE][0]['summary'] = $revision->teaser; } === modified file 'modules/node/node.module' --- modules/node/node.module 2010-01-08 07:36:53 +0000 +++ modules/node/node.module 2010-01-08 20:30:07 +0000 @@ -597,52 +597,27 @@ 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('node', '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', - 'object_type' => 'node', - '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, - ), +/** +* Implement hook_field_extra_fields(). +*/ +function node_field_extra_fields() { + $extra = array(); + + foreach (node_type_get_types() as $type) { + if ($type->has_title) { + $extra['node'][$type->type] = array( + 'title' => array( + 'label' => $type->title_label, + 'description' => t('Node module element.'), + 'weight' => -5, ), ); - field_create_instance($instance); - } - else { - $instance['label'] = $type->title_label; - field_update_instance($instance); } } + + return $extra; } /** @@ -1007,14 +982,6 @@ 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 = 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); @@ -1039,9 +1006,6 @@ 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'). @@ -1252,7 +1216,7 @@ function node_build_content($node, $view $links['node_readmore'] = array( 'title' => t('Read more'), 'href' => 'node/' . $node->nid, - 'attributes' => array('rel' => 'tag', 'title' => strip_tags($node->title[LANGUAGE_NONE][0]['value'])) + 'attributes' => array('rel' => 'tag', 'title' => strip_tags($node->title)) ); } $node->content['links']['node'] = array( @@ -1323,7 +1287,7 @@ function node_language_provider($languag */ function node_show($node, $message = FALSE) { if ($message) { - drupal_set_title(t('Revision of %title from %date', array('%title' => $node->title[LANGUAGE_NONE][0]['value'], '%date' => format_date($node->revision_timestamp))), PASS_THROUGH); + drupal_set_title(t('Revision of %title from %date', array('%title' => $node->title, '%date' => format_date($node->revision_timestamp))), PASS_THROUGH); } // Update the history table, stating that this user viewed this node. @@ -1368,7 +1332,7 @@ function template_preprocess_node(&$vari $variables['date'] = format_date($node->created); $variables['name'] = theme('username', array('account' => $node)); $variables['node_url'] = url('node/' . $node->nid); - $variables['node_title'] = check_plain($node->title[LANGUAGE_NONE][0]['value']); + $variables['node_title'] = check_plain($node->title); $variables['page'] = node_is_page($node); if (!empty($node->in_preview)) { @@ -1386,10 +1350,6 @@ 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; @@ -1615,7 +1575,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[LANGUAGE_NONE][0]['value'], + 'title' => $node->title, 'user' => theme('username', array('account' => $node)), 'date' => $node->changed, 'node' => $node, @@ -1898,6 +1858,8 @@ 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', @@ -2121,7 +2083,7 @@ function node_feed($nids = FALSE, $chann $item_text .= drupal_render($build); } - $items .= format_rss_item($node->title[LANGUAGE_NONE][0]['value'], $node->link, $item_text, $node->rss_elements); + $items .= format_rss_item($node->title, $node->link, $item_text, $node->rss_elements); } $channel_defaults = array( @@ -2224,19 +2186,12 @@ function node_page_default() { * Menu callback; view a single node. */ function node_page_view($node) { - $return = node_show($node); - if (isset($return['nodes'][$node->nid]['title'])) { - // Get the language that was determined by language fallback logic during the - // field_attach_display() workflow. - // @todo That logic should be made available separately. - $langcode = $return['nodes'][$node->nid]['title']['#language']; - drupal_set_title($node->title[$langcode][0]['value']); - } + drupal_set_title($node->title); // Set the node path as the canonical URL to prevent duplicate content. drupal_add_html_head_link(array('rel' => 'canonical', 'href' => url('node/' . $node->nid)), TRUE); // Set the non-aliased path as a default shortlink. drupal_add_html_head_link(array('rel' => 'shortlink', 'href' => url('node/' . $node->nid, array('alias' => TRUE))), TRUE); - return $return; + return node_show($node); } /** @@ -2270,7 +2225,7 @@ function _node_index_node($node) { unset($build['#theme']); $node->rendered = drupal_render($build); - $text = '

' . check_plain($node->title[LANGUAGE_NONE][0]['value']) . '

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

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

' . $node->rendered; // Fetch extra data normally not visible $extra = module_invoke_all('node_update_index', $node); @@ -2986,10 +2941,20 @@ function _node_access_rebuild_batch_fini * Implements hook_form(). */ function node_content_form($node, $form_state) { - // It is impossible to define a content type without implementing hook_form() - // so simply return an empty array(). - // @todo: remove this requirement. - return array(); + $type = node_type_get_type($node); + + if ($type->has_title) { + $form['title'] = array( + '#type' => 'textfield', + '#title' => check_plain($type->title_label), + '#required' => TRUE, + '#default_value' => $node->title, + '#maxlength' => 255, + '#weight' => -5, + ); + } + + return $form; } /** @@ -3084,7 +3049,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[LANGUAGE_NONE][0]['value'])); + watchdog('action', 'Set @type %title to published.', array('@type' => node_type_get_name($node), '%title' => $node->title)); } /** @@ -3092,7 +3057,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[LANGUAGE_NONE][0]['value'])); + watchdog('action', 'Set @type %title to unpublished.', array('@type' => node_type_get_name($node), '%title' => $node->title)); } /** @@ -3100,7 +3065,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[LANGUAGE_NONE][0]['value'])); + watchdog('action', 'Set @type %title to sticky.', array('@type' => node_type_get_name($node), '%title' => $node->title)); } /** @@ -3108,7 +3073,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[LANGUAGE_NONE][0]['value'])); + watchdog('action', 'Set @type %title to unsticky.', array('@type' => node_type_get_name($node), '%title' => $node->title)); } /** @@ -3116,7 +3081,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[LANGUAGE_NONE][0]['value'])); + watchdog('action', 'Promoted @type %title to front page.', array('@type' => node_type_get_name($node), '%title' => $node->title)); } /** @@ -3124,7 +3089,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[LANGUAGE_NONE][0]['value'])); + watchdog('action', 'Removed @type %title from front page.', array('@type' => node_type_get_name($node), '%title' => $node->title)); } /** @@ -3132,7 +3097,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[LANGUAGE_NONE][0]['value'])); + watchdog('action', 'Saved @type %title', array('@type' => node_type_get_name($node), '%title' => $node->title)); } /** @@ -3141,7 +3106,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[LANGUAGE_NONE][0]['value'], '%name' => $owner_name)); + watchdog('action', 'Changed owner of @type %title to uid %name.', array('@type' => node_type_get_type($node), '%title' => $node->title, '%name' => $owner_name)); } /** @@ -3236,7 +3201,7 @@ function node_unpublish_by_keyword_actio foreach ($context['keywords'] as $keyword) { if (strpos(drupal_render(node_view(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[LANGUAGE_NONE][0]['value'])); + watchdog('action', 'Set @type %title to unpublished.', array('@type' => node_type_get_name($node), '%title' => $node->title)); break; } } @@ -3280,11 +3245,6 @@ class NodeController extends DrupalDefau // object type specific callback. $typed_nodes = array(); foreach ($nodes as $id => $object) { - // The value loaded in $object->title is the one stored in {node}.title, - // which is used for building list queries. By unsetting it here, we - // allow DrupalDefaultEntityController:attachLoad() to populate it along - // with all the other field values for consistency. - unset($object->title); $typed_nodes[$object->type][$id] = $object; } === modified file 'modules/node/node.pages.inc' --- modules/node/node.pages.inc 2010-01-03 21:01:04 +0000 +++ modules/node/node.pages.inc 2010-01-08 20:30:07 +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[LANGUAGE_NONE][0]['value'])), PASS_THROUGH); + drupal_set_title(t('Edit @type @title', array('@type' => $type_name, '@title' => $node->title)), PASS_THROUGH); return drupal_get_form($node->type . '_node_form', $node); } @@ -154,6 +154,9 @@ function node_form($form, &$form_state, 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; @@ -423,8 +426,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[LANGUAGE_NONE][0]['value']); - $t_args = array('@type' => node_type_get_name($node), '%title' => $node->title[LANGUAGE_NONE][0]['value']); + $watchdog_args = array('@type' => $node->type, '%title' => $node->title); + $t_args = array('@type' => node_type_get_name($node), '%title' => $node->title); if ($insert) { watchdog('content', '@type: added %title.', $watchdog_args, WATCHDOG_NOTICE, $node_link); @@ -474,7 +477,7 @@ function node_delete_confirm($form, &$fo ); return confirm_form($form, - t('Are you sure you want to delete %title?', array('%title' => $node->title[LANGUAGE_NONE][0]['value'])), + t('Are you sure you want to delete %title?', array('%title' => $node->title)), 'node/' . $node->nid, t('This action cannot be undone.'), t('Delete'), @@ -489,8 +492,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[LANGUAGE_NONE][0]['value'])); - drupal_set_message(t('@type %title has been deleted.', array('@type' => node_type_get_name($node), '%title' => $node->title[LANGUAGE_NONE][0]['value']))); + 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))); } $form_state['redirect'] = ''; @@ -500,7 +503,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[LANGUAGE_NONE][0]['value'])), PASS_THROUGH); + drupal_set_title(t('Revisions for %title', array('%title' => $node->title)), PASS_THROUGH); $header = array(t('Revision'), array('data' => t('Operations'), 'colspan' => 2)); @@ -562,8 +565,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[LANGUAGE_NONE][0]['value'], '%revision' => $node_revision->vid)); - drupal_set_message(t('@type %title has been reverted back to the revision from %revision-date.', array('@type' => node_type_get_name($node_revision), '%title' => $node_revision->title[LANGUAGE_NONE][0]['value'], '%revision-date' => format_date($node_revision->revision_timestamp)))); + 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)))); $form_state['redirect'] = 'node/' . $node_revision->nid . '/revisions'; } @@ -576,8 +579,8 @@ function node_revision_delete_confirm_su $node_revision = $form['#node_revision']; node_revision_delete($node_revision->vid); - watchdog('content', '@type: deleted %title revision %revision.', array('@type' => $node_revision->type, '%title' => $node_revision->title[LANGUAGE_NONE][0]['value'], '%revision' => $node_revision->vid)); - drupal_set_message(t('Revision from %revision-date of @type %title has been deleted.', array('%revision-date' => format_date($node_revision->revision_timestamp), '@type' => node_type_get_name($node_revision), '%title' => $node_revision->title[LANGUAGE_NONE][0]['value']))); + 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))); $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'; === modified file 'modules/node/node.test' --- modules/node/node.test 2010-01-08 07:05:52 +0000 +++ modules/node/node.test 2010-01-08 20:30:07 +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[LANGUAGE_NONE][0]['value'], t('Node title appears on the default listing.')); - $this->assertText($node2->title[LANGUAGE_NONE][0]['value'], t('Node title appears on the default listing.')); - $this->assertNoText($node3->title[LANGUAGE_NONE][0]['value'], t('Node title does not appear in the default listing.')); - $this->assertNoText($node4->title[LANGUAGE_NONE][0]['value'], t('Node title does not appear in the default listing.')); + $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.')); // 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[LANGUAGE_NONE][0]['value'], $nodes[$node3->nid]->title[LANGUAGE_NONE][0]['value'], t('Node was loaded.')); - $this->assertEqual($node4->title[LANGUAGE_NONE][0]['value'], $nodes[$node4->nid]->title[LANGUAGE_NONE][0]['value'], t('Node was loaded.')); + $this->assertEqual($node3->title, $nodes[$node3->nid]->title, t('Node was loaded.')); + $this->assertEqual($node4->title, $nodes[$node4->nid]->title, 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[LANGUAGE_NONE][0]['value'], $node1->title[LANGUAGE_NONE][0]['value'], t('Node successfully loaded.')); - $this->assertEqual($nodes[$node2->nid]->title[LANGUAGE_NONE][0]['value'], $node2->title[LANGUAGE_NONE][0]['value'], t('Node successfully loaded.')); - $this->assertEqual($nodes[$node3->nid]->title[LANGUAGE_NONE][0]['value'], $node3->title[LANGUAGE_NONE][0]['value'], t('Node successfully loaded.')); + $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->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[LANGUAGE_NONE][0]['value'], $node1->title[LANGUAGE_NONE][0]['value'], t('Node successfully loaded')); - $this->assertEqual($nodes[$node2->nid]->title[LANGUAGE_NONE][0]['value'], $node2->title[LANGUAGE_NONE][0]['value'], t('Node successfully loaded')); - $this->assertEqual($nodes[$node3->nid]->title[LANGUAGE_NONE][0]['value'], $node3->title[LANGUAGE_NONE][0]['value'], t('Node successfully loaded')); + $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->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[LANGUAGE_NONE][0]['value'], $node3->title[LANGUAGE_NONE][0]['value'], t('Node successfully loaded.')); + $this->assertEqual($nodes[$node3->nid]->title, $node3->title, 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[LANGUAGE_NONE][0]['value'], + array('@type' => 'Page', '%title' => $nodes[1]->title, '%revision-date' => format_date($nodes[1]->revision_timestamp))), t('Revision reverted.')); $reverted_node = node_load($node->nid); $this->assertTrue(($nodes[1]->body[LANGUAGE_NONE][0]['value'] == $reverted_node->body[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[LANGUAGE_NONE][0]['value'])), t('Revision deleted.')); + '@type' => 'Page', '%title' => $nodes[1]->title)), 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,7 +187,7 @@ class PageEditTestCase extends DrupalWeb */ function testPageEdit() { $langcode = LANGUAGE_NONE; - $title_key = "title[$langcode][0][value]"; + $title_key = "title"; $body_key = "body[$langcode][0][value]"; // Create node to edit. $edit = array(); @@ -229,13 +229,13 @@ class PageEditTestCase extends DrupalWeb // Edit the same node, creating a new revision. $this->drupalGet("node/$node->nid/edit"); $edit = array(); - $edit[$title_key] = $this->randomName(8); + $edit['title'] = $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_key]); + $revised_node = $this->drupalGetNodeByTitle($edit['title']); $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. @@ -269,7 +269,7 @@ class PagePreviewTestCase extends Drupal */ function testPagePreview() { $langcode = LANGUAGE_NONE; - $title_key = "title[$langcode][0][value]"; + $title_key = "title"; $body_key = "body[$langcode][0][value]"; // Fill in node creation form and preview node. @@ -293,7 +293,7 @@ class PagePreviewTestCase extends Drupal */ function testPagePreviewWithRevisions() { $langcode = LANGUAGE_NONE; - $title_key = "title[$langcode][0][value]"; + $title_key = "title"; $body_key = "body[$langcode][0][value]"; // Force revision on page content. variable_set('node_options_page', array('status', 'revision')); @@ -343,15 +343,15 @@ class NodeCreationTestCase extends Drupa // Create a node. $edit = array(); $langcode = LANGUAGE_NONE; - $edit["title[$langcode][0][value]"] = $this->randomName(8); + $edit["title"] = $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[$langcode][0][value]"])), t('Page created.')); + $this->assertRaw(t('!post %title has been created.', array('!post' => 'Page', '%title' => $edit["title"])), t('Page created.')); // Check that the node exists in the database. - $node = $this->drupalGetNodeByTitle($edit["title[$langcode][0][value]"]); + $node = $this->drupalGetNodeByTitle($edit["title"]); $this->assertTrue($node, t('Node found in database.')); } @@ -362,18 +362,18 @@ class NodeCreationTestCase extends Drupa // Create a node. $edit = array(); $langcode = LANGUAGE_NONE; - $edit["title[$langcode][0][value]"] = 'testing_transaction_exception'; + $edit["title"] = 'testing_transaction_exception'; $edit["body[$langcode][0][value]"] = $this->randomName(16); $this->drupalPost('node/add/page', $edit, t('Save')); if (Database::getConnection()->supportsTransactions()) { // Check that the node does not exist in the database. - $node = $this->drupalGetNodeByTitle($edit["title[$langcode][0][value]"]); + $node = $this->drupalGetNodeByTitle($edit["title"]); $this->assertFalse($node, t('Transactions supported, and node not found in database.')); } else { // Check that the node exists in the database. - $node = $this->drupalGetNodeByTitle($edit["title[$langcode][0][value]"]); + $node = $this->drupalGetNodeByTitle($edit["title"]); $this->assertTrue($node, t('Transactions not supported, and node found in database.')); // Check that the failed rollback was logged. @@ -484,20 +484,17 @@ class NodeTitleXSSTestCase extends Drupa $xss = ''; $title = $xss . $this->randomName(); - $langcode = LANGUAGE_NONE; - $edit = array( - "title[$langcode][0][value]" => $title, - ); + $edit = array("title" => $title,); $this->drupalPost('node/add/page', $edit, t('Preview')); $this->assertNoRaw($xss, t('Harmful tags are escaped when previewing a node.')); - $settings = array('title' => array(LANGUAGE_NONE => array(array('value' => $title)))); + $settings = array('title' => $title); $node = $this->drupalCreateNode($settings); $this->drupalGet('node/' . $node->nid); // assertTitle() decodes HTML-entities inside the element. - $this->assertTitle($edit["title[$langcode][0][value]"] . ' | Drupal', t('Title is diplayed when viewing a node.')); + $this->assertTitle($edit["title"] . ' | 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'); @@ -567,12 +564,12 @@ class NodePostSettingsTestCase extends D // Create a node. $edit = array(); $langcode = LANGUAGE_NONE; - $edit["title[$langcode][0][value]"] = $this->randomName(8); + $edit["title"] = $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[$langcode][0][value]"]); + $node = $this->drupalGetNodeByTitle($edit["title"]); $this->assertRaw('<span class="submitted">', t('Post information is displayed.')); } @@ -589,12 +586,12 @@ class NodePostSettingsTestCase extends D // Create a node. $edit = array(); $langcode = LANGUAGE_NONE; - $edit["title[$langcode][0][value]"] = $this->randomName(8); + $edit["title"] = $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[$langcode][0][value]"]); + $node = $this->drupalGetNodeByTitle($edit["title"]); $this->assertNoRaw('<span class="submitted">', t('Post information is not displayed.')); } } @@ -833,7 +830,7 @@ class NodeSaveTestCase extends DrupalWeb $test_nid = $max_nid + mt_rand(1000, 1000000); $title = $this->randomName(8); $node = array( - 'title' => array(LANGUAGE_NONE => array(array('value' => $title))), + 'title' => $title, 'body' => array(LANGUAGE_NONE => array(array('value' => $this->randomName(32)))), 'uid' => $this->web_user->uid, 'type' => 'article', @@ -1130,23 +1127,23 @@ class NodeTitleTestCase extends DrupalWe function testNodeTitle() { // Create page content with title $settings = array( - 'title' => array(LANGUAGE_NONE => array(array('value' => $this->randomName(8)))), + 'title' => $this->randomName(8), ); $node = $this->drupalCreateNode($settings); // Test <title> tag. $this->drupalGet("node/$node->nid"); $xpath = '//title'; - $this->assertEqual(current($this->xpath($xpath)), $node->title[LANGUAGE_NONE][0]['value'] .' | Drupal', 'Page title is equal to node title.', 'Node'); + $this->assertEqual(current($this->xpath($xpath)), $node->title .' | Drupal', 'Page title is equal to node title.', 'Node'); // Test breadcrumb in comment preview. $this->drupalGet("comment/reply/$node->nid"); $xpath = '//div[@class="breadcrumb"]/a[last()]'; - $this->assertEqual(current($this->xpath($xpath)), $node->title[LANGUAGE_NONE][0]['value'], 'Node breadcrumb is equal to node title.', 'Node'); + $this->assertEqual(current($this->xpath($xpath)), $node->title, 'Node breadcrumb is equal to node title.', 'Node'); // Test node title in comment preview. $xpath = '//div[@id="node-'. $node->nid .'"]/h2/a'; - $this->assertEqual(current($this->xpath($xpath)), $node->title[LANGUAGE_NONE][0]['value'], 'Node preview title is equal to node title.', 'Node'); + $this->assertEqual(current($this->xpath($xpath)), $node->title, 'Node preview title is equal to node title.', 'Node'); } } === modified file 'modules/node/node.tokens.inc' --- modules/node/node.tokens.inc 2010-01-07 20:55:49 +0000 +++ modules/node/node.tokens.inc 2010-01-08 20:30:07 +0000 @@ -134,7 +134,7 @@ function node_tokens($type, $tokens, arr break; case 'title': - $replacements[$original] = $sanitize ? check_plain($node->title[LANGUAGE_NONE][0]['value']) : $node->title[LANGUAGE_NONE][0]['value']; + $replacements[$original] = $sanitize ? check_plain($node->title) : $node->title; break; case 'body': === modified file 'modules/node/tests/node_test_exception.module' --- modules/node/tests/node_test_exception.module 2009-12-22 14:19:25 +0000 +++ modules/node/tests/node_test_exception.module 2010-01-08 20:30:07 +0000 @@ -11,7 +11,7 @@ * Implements hook_node_insert(). */ function node_test_exception_node_insert($node) { - if ($node->title[LANGUAGE_NONE][0]['value'] == 'testing_transaction_exception') { + if ($node->title == 'testing_transaction_exception') { throw new Exception('Test exception for rollback.'); } } === modified file 'modules/path/path.test' --- modules/path/path.test 2009-12-09 19:22:04 +0000 +++ modules/path/path.test 2010-01-08 20:30:07 +0000 @@ -63,7 +63,7 @@ class PathTestCase extends DrupalWebTest // Confirm that the alias works. $this->drupalGet($edit['alias']); - $this->assertText($node1->title[LANGUAGE_NONE][0]['value'], 'Alias works.'); + $this->assertText($node1->title, 'Alias works.'); $this->assertResponse(200); // Change alias. @@ -75,7 +75,7 @@ class PathTestCase extends DrupalWebTest // Confirm that the alias works. $this->drupalGet($edit['alias']); - $this->assertText($node1->title[LANGUAGE_NONE][0]['value'], 'Changed alias works.'); + $this->assertText($node1->title, 'Changed alias works.'); $this->assertResponse(200); drupal_static_reset('drupal_lookup_path'); @@ -118,7 +118,7 @@ class PathTestCase extends DrupalWebTest // Confirm that the alias works. $this->drupalGet($edit['path[alias]']); - $this->assertText($node1->title[LANGUAGE_NONE][0]['value'], 'Alias works.'); + $this->assertText($node1->title, 'Alias works.'); $this->assertResponse(200); // Change alias. @@ -128,12 +128,12 @@ class PathTestCase extends DrupalWebTest // Confirm that the alias works. $this->drupalGet($edit['path[alias]']); - $this->assertText($node1->title[LANGUAGE_NONE][0]['value'], 'Changed alias works.'); + $this->assertText($node1->title, 'Changed alias works.'); $this->assertResponse(200); // Make sure that previous alias no longer works. $this->drupalGet($previous); - $this->assertNoText($node1->title[LANGUAGE_NONE][0]['value'], 'Previous alias no longer works.'); + $this->assertNoText($node1->title, 'Previous alias no longer works.'); $this->assertResponse(404); // Create second test node. @@ -270,7 +270,7 @@ class PathLanguageTestCase extends Drupa // Confirm that the alias works. $this->drupalGet($edit['path[alias]']); - $this->assertText($english_node->title[LANGUAGE_NONE][0]['value'], 'Alias works.'); + $this->assertText($english_node->title, 'Alias works.'); // Translate the node into French. $this->drupalGet('node/' . $english_node->nid . '/translate'); @@ -279,7 +279,7 @@ class PathLanguageTestCase extends Drupa $langcode = 'fr'; $edit["body[$langcode][0][value]"] = $this->randomName(); $langcode = LANGUAGE_NONE; - $edit["title[$langcode][0][value]"] = $this->randomName(); + $edit["title"] = $this->randomName(); $edit['path[alias]'] = $this->randomName(); $this->drupalPost(NULL, $edit, t('Save')); @@ -287,12 +287,12 @@ class PathLanguageTestCase extends Drupa drupal_lookup_path('wipe'); // Ensure the node was created. - $french_node = $this->drupalGetNodeByTitle($edit["title[$langcode][0][value]"]); + $french_node = $this->drupalGetNodeByTitle($edit["title"]); $this->assertTrue(($french_node), 'Node found in database.'); // Confirm that the alias works. $this->drupalGet('fr/' . $edit['path[alias]']); - $this->assertText($french_node->title[LANGUAGE_NONE][0]['value'], 'Alias for French translation works.'); + $this->assertText($french_node->title, 'Alias for French translation works.'); // Confirm that the alias is returned by url(). drupal_static_reset('language_list'); === modified file 'modules/php/php.test' --- modules/php/php.test 2010-01-03 20:16:59 +0000 +++ modules/php/php.test 2010-01-08 20:30:07 +0000 @@ -79,7 +79,7 @@ class PHPFilterTestCase extends PHPTestC $langcode = LANGUAGE_NONE; $edit["body[$langcode][0][value_format]"] = $this->php_code_format; $this->drupalPost('node/' . $node->nid . '/edit', $edit, t('Save')); - $this->assertRaw(t('Page %title has been updated.', array('%title' => $node->title[LANGUAGE_NONE][0]['value'])), t('PHP code filter turned on.')); + $this->assertRaw(t('Page %title has been updated.', array('%title' => $node->title)), t('PHP code filter turned on.')); // Make sure that the PHP code shows up as text. $this->assertNoText('print "SimpleTest PHP was executed!"', t("PHP code isn't displayed.")); === modified file 'modules/poll/poll.module' --- modules/poll/poll.module 2010-01-08 07:36:53 +0000 +++ modules/poll/poll.module 2010-01-08 20:30:07 +0000 @@ -222,6 +222,14 @@ function poll_form($node, &$form_state) $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']; } @@ -721,7 +729,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[LANGUAGE_NONE][0]['value']); + $variables['title'] = check_plain($form['#node']->title); $variables['vote'] = drupal_render($form['vote']); $variables['rest'] = drupal_render_children($form); $variables['block'] = $form['#block']; @@ -753,7 +761,7 @@ function poll_view_results($node, $view_ } } - return theme('poll_results', array('raw_title' => $node->title[LANGUAGE_NONE][0]['value'], 'results' => $poll_results, 'votes' => $total_votes, 'raw_links' => isset($node->links) ? $node->links : array(), 'block' => $block, 'nid' => $node->nid, 'vote' => isset($node->vote) ? $node->vote : NULL)); + return theme('poll_results', array('raw_title' => $node->title, 'results' => $poll_results, 'votes' => $total_votes, 'raw_links' => isset($node->links) ? $node->links : array(), 'block' => $block, 'nid' => $node->nid, 'vote' => isset($node->vote) ? $node->vote : NULL)); } === modified file 'modules/poll/poll.pages.inc' --- modules/poll/poll.pages.inc 2009-12-02 19:26:21 +0000 +++ modules/poll/poll.pages.inc 2010-01-08 20:30:07 +0000 @@ -51,7 +51,7 @@ function poll_page() { */ function poll_votes($node) { $votes_per_page = 20; - drupal_set_title($node->title[LANGUAGE_NONE][0]['value']); + drupal_set_title($node->title); $header[] = array('data' => t('Visitor'), 'field' => 'u.name'); $header[] = array('data' => t('Vote'), 'field' => 'pc.chtext'); @@ -92,7 +92,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[LANGUAGE_NONE][0]['value']); + drupal_set_title($node->title); $node->show_results = TRUE; return node_show($node); } === modified file 'modules/poll/poll.test' --- modules/poll/poll.test 2009-12-02 19:26:21 +0000 +++ modules/poll/poll.test 2010-01-08 20:30:07 +0000 @@ -59,7 +59,7 @@ class PollTestCase extends DrupalWebTest $langcode = LANGUAGE_NONE; $edit = array( - "title[$langcode][0][value]" => $title + "title" => $title ); foreach ($already_submitted_choices as $k => $text) { $edit['choice[chid:' . $k . '][chtext]'] = $text; @@ -334,7 +334,7 @@ class PollJSAddChoice extends DrupalWebT $this->drupalGet('node/add/poll'); $langcode = LANGUAGE_NONE; $edit = array( - "title[$langcode][0][value]" => $this->randomName(), + "title" => $this->randomName(), 'choice[new:0][chtext]' => $this->randomName(), 'choice[new:1][chtext]' => $this->randomName(), ); === modified file 'modules/search/search.api.php' --- modules/search/search.api.php 2010-01-08 07:05:52 +0000 +++ modules/search/search.api.php 2010-01-08 20:30:07 +0000 @@ -194,7 +194,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[LANGUAGE_NONE][0]['value'], + 'title' => $node->title, 'user' => theme('username', array('account' => $node)), 'date' => $node->changed, 'node' => $node, @@ -303,7 +303,7 @@ function hook_update_index() { node_build_content($node, 'search_index'); $node->rendered = drupal_render($node->content); - $text = '<h1>' . check_plain($node->title[LANGUAGE_NONE][0]['value']) . '</h1>' . $node->rendered; + $text = '<h1>' . check_plain($node->title) . '</h1>' . $node->rendered; // Fetch extra data normally not visible $extra = module_invoke_all('node_update_index', $node); === modified file 'modules/search/search.test' --- modules/search/search.test 2010-01-07 05:23:51 +0000 +++ modules/search/search.test 2010-01-08 20:30:07 +0000 @@ -312,17 +312,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[LANGUAGE_NONE][0]['value']); - $this->assertText($this->node->title[LANGUAGE_NONE][0]['value'], t('Page node is found with GET query.')); + $this->drupalGet('search/node/' . $this->node->title); + $this->assertText($this->node->title, 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[LANGUAGE_NONE][0]['value']); + $edit = array('or' => $this->node->title); $this->drupalPost('search/node', $edit, t('Advanced search')); - $this->assertText($this->node->title[LANGUAGE_NONE][0]['value'], t('Page node is found with POST query.')); + $this->assertText($this->node->title, 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[LANGUAGE_NONE][0]['value'], t('Page node is found with POST query and type:page.')); + $this->assertText($this->node->title, 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.')); @@ -537,7 +537,7 @@ class SearchCommentTestCase extends Drup 'search_block_form' => $edit_comment['subject'], ); $this->drupalPost('', $edit, t('Search')); - $this->assertText($node->title[LANGUAGE_NONE][0]['value'], t('Node found in search results.')); + $this->assertText($node->title, t('Node found in search results.')); $this->assertText($edit_comment['subject'], t('Comment subject found in search results.')); // Search for the comment body. @@ -545,7 +545,7 @@ class SearchCommentTestCase extends Drup 'search_block_form' => $comment_body, ); $this->drupalPost('', $edit, t('Search')); - $this->assertText($node->title[LANGUAGE_NONE][0]['value'], t('Node found in search results.')); + $this->assertText($node->title, t('Node found in search results.')); // Verify that comment is rendered using proper format. $this->assertText($comment_body, t('Comment body text found in search results.')); === modified file 'modules/simpletest/drupal_web_test_case.php' --- modules/simpletest/drupal_web_test_case.php 2010-01-04 23:08:34 +0000 +++ modules/simpletest/drupal_web_test_case.php 2010-01-08 20:30:07 +0000 @@ -738,7 +738,7 @@ class DrupalWebTestCase extends DrupalTe // Populate defaults array. $settings += array( 'body' => array(LANGUAGE_NONE => array(array())), - 'title' => array(LANGUAGE_NONE => array(array('value' => $this->randomName(8)))), + 'title' => $this->randomName(8), 'comment' => 2, 'changed' => REQUEST_TIME, 'moderate' => 0, === modified file 'modules/statistics/statistics.pages.inc' --- modules/statistics/statistics.pages.inc 2009-12-02 19:26:21 +0000 +++ modules/statistics/statistics.pages.inc 2010-01-08 20:30:07 +0000 @@ -38,7 +38,7 @@ function statistics_node_tracker() { ); } - drupal_set_title($node->title[LANGUAGE_NONE][0]['value']); + drupal_set_title($node->title); $build['statistics_table'] = array( '#theme' => 'table', '#header' => $header, === modified file 'modules/statistics/statistics.test' --- modules/statistics/statistics.test 2010-01-07 08:04:12 +0000 +++ modules/statistics/statistics.test 2010-01-08 20:33:06 +0000 @@ -119,7 +119,7 @@ class StatisticsReportsTestCase extends $this->assertText('All time', t('Found the alll time popular content.')); $this->assertText('Last viewed', t('Found the last viewed popular content.')); - $this->assertRaw(l($node->title[LANGUAGE_NONE][0]['value'], 'node/' . $node->nid), t('Found link to visited node.')); + $this->assertRaw(l($node->title, 'node/' . $node->nid), t('Found link to visited node.')); } } === modified file 'modules/system/system.api.php' --- modules/system/system.api.php 2010-01-08 11:07:01 +0000 +++ modules/system/system.api.php 2010-01-08 20:34:08 +0000 @@ -1354,7 +1354,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[LANGUAGE_NONE][0]['value'], + '%title' => $node->title, '%teaser' => $node->teaser, '%body' => $node->body, ); @@ -2953,7 +2953,7 @@ function hook_tokens($type, $tokens, arr break; case 'title': - $replacements[$original] = $sanitize ? check_plain($node->title[LANGUAGE_NONE][0]['value']) : $node->title[LANGUAGE_NONE][0]['value']; + $replacements[$original] = $sanitize ? check_plain($node->title) : $node->title; break; case 'edit-url': === modified file 'modules/system/system.test' --- modules/system/system.test 2010-01-04 21:31:52 +0000 +++ modules/system/system.test 2010-01-08 20:30:07 +0000 @@ -571,7 +571,7 @@ class AccessDeniedTestCase extends Drupa $this->assertResponse(403); $edit = array( - 'title' => array(LANGUAGE_NONE => array(array('value' => $this->randomName(10)))), + 'title' => $this->randomName(10), 'body' => array(LANGUAGE_NONE => array(array('value' => $this->randomName(100)))), ); $node = $this->drupalCreateNode($edit); @@ -580,13 +580,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[LANGUAGE_NONE][0]['value'], t('Found the custom 403 page')); + $this->assertText($node->title, 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[LANGUAGE_NONE][0]['value'], t('Found the custom 403 page')); + $this->assertText($node->title, 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. @@ -649,7 +649,7 @@ class PageNotFoundTestCase extends Drupa $this->assertText(t('Page not found'), t('Found the default 404 page')); $edit = array( - 'title' => array(LANGUAGE_NONE => array(array('value' => $this->randomName(10)))), + 'title' => $this->randomName(10), 'body' => array(LANGUAGE_NONE => array(array('value' => $this->randomName(100)))), ); $node = $this->drupalCreateNode($edit); @@ -658,7 +658,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[LANGUAGE_NONE][0]['value'], t('Found the custom 404 page')); + $this->assertText($node->title, t('Found the custom 404 page')); } } @@ -924,16 +924,16 @@ class PageTitleFiltering extends DrupalW // Generate node content. $langcode = LANGUAGE_NONE; $edit = array( - "title[$langcode][0][value]" => '!SimpleTest! ' . $title . $this->randomName(20), + "title" => '!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[$langcode][0][value]"]); + $node = $this->drupalGetNodeByTitle($edit["title"]); $this->assertNotNull($node, 'Node created and found in database'); $this->drupalGet("node/" . $node->nid); - $this->assertText(check_plain($edit["title[$langcode][0][value]"]), 'Check to make sure tags in the node title are converted.'); + $this->assertText(check_plain($edit["title"]), 'Check to make sure tags in the node title are converted.'); } } @@ -1415,7 +1415,7 @@ class TokenReplaceTestCase extends Drupa // Create the initial objects. $account = $this->drupalCreateUser(); $node = $this->drupalCreateNode(array('uid' => $account->uid)); - $node->title = array(LANGUAGE_NONE => array(array('value' => '<blink>Blinking Text</blink>'))); + $node->title = '<blink>Blinking Text</blink>'; global $user, $language; $source = '[node:title]'; // Title of the node we passed in @@ -1426,7 +1426,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[LANGUAGE_NONE][0]['value']); + $target = check_plain($node->title); $target .= check_plain($account->name); $target .= format_interval(REQUEST_TIME - $node->created, 2, $language->language); $target .= check_plain($user->name); @@ -1444,10 +1444,10 @@ 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[LANGUAGE_NONE][0]['value'])), t('Token sanitized.')); + $this->assertFalse(strcmp($generated['[node:title]'], check_plain($node->title)), t('Token sanitized.')); $generated = token_generate('node', $raw_tokens, array('node' => $node), array('sanitize' => FALSE)); - $this->assertFalse(strcmp($generated['[node:title]'], $node->title[LANGUAGE_NONE][0]['value']), t('Unsanitized token generated properly.')); + $this->assertFalse(strcmp($generated['[node:title]'], $node->title), t('Unsanitized token generated properly.')); } } === modified file 'modules/system/system.tokens.inc' --- modules/system/system.tokens.inc 2009-12-04 16:49:45 +0000 +++ modules/system/system.tokens.inc 2010-01-08 20:30:07 +0000 @@ -283,7 +283,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[LANGUAGE_NONE][0]['value']) : $node->title[LANGUAGE_NONE][0]['value']; + $replacements[$original] = $sanitize ? filter_xss($node->title) : $node->title; } break; === modified file 'modules/taxonomy/taxonomy.test' --- modules/taxonomy/taxonomy.test 2010-01-08 07:05:52 +0000 +++ modules/taxonomy/taxonomy.test 2010-01-08 20:34:56 +0000 @@ -379,13 +379,13 @@ class TaxonomyTermTestCase extends Taxon // Post an article. $edit = array(); $langcode = LANGUAGE_NONE; - $edit["title[$langcode][0][value]"] = $this->randomName(); + $edit["title"] = $this->randomName(); $edit["body[$langcode][0][value]"] = $this->randomName(); $edit[$this->instance['field_name'] . '[' . $langcode .'][]'] = $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[$langcode][0][value]"]); + $node = $this->drupalGetNodeByTitle($edit["title"]); $this->drupalGet('node/' . $node->nid); $this->assertText($term1->name, t('Term is displayed when viewing the node.')); @@ -414,13 +414,13 @@ class TaxonomyTermTestCase extends Taxon $edit = array(); $langcode = LANGUAGE_NONE; - $edit["title[$langcode][0][value]"] = $this->randomName(); + $edit["title"] = $this->randomName(); $edit["body[$langcode][0][value]"] = $this->randomName(); // Insert the terms in a comma separated list. Vocabulary 1 is a // free-tagging field created by the default profile. $edit[$instance['field_name'] . "[$langcode]"] = implode(', ', $terms); $this->drupalPost('node/add/page', $edit, t('Save')); - $this->assertRaw(t('@type %title has been created.', array('@type' => t('Page'), '%title' => $edit["title[$langcode][0][value]"])), t('The node was created successfully')); + $this->assertRaw(t('@type %title has been created.', array('@type' => t('Page'), '%title' => $edit["title"])), t('The node was created successfully')); foreach ($terms as $term) { $this->assertText($term, t('The term was saved and appears on the node page')); } @@ -950,15 +950,15 @@ class TaxonomyNodeFilterTestCase extends search_update_totals(); // Search for the node title. - $this->drupalGet('search/node/' . $node->title[$this->langcode][0]['value']); - $this->assertText($node->title[$this->langcode][0]['value'], t('Article node found with search.')); + $this->drupalGet('search/node/' . $node->title); + $this->assertText($node->title, t('Article node found with search.')); // Search for the node title, filtering by term 1. - $this->drupalGet('search/node/' . $node->title[$this->langcode][0]['value'] . ' term:' . $term1->tid); - $this->assertText($node->title[$this->langcode][0]['value'], t('Article node found with search filtering by term 1.')); + $this->drupalGet('search/node/' . $node->title . ' term:' . $term1->tid); + $this->assertText($node->title, t('Article node found with search filtering by term 1.')); // Search for the node title, filtering by term 2. - $this->drupalGet('search/node/' . $node->title[$this->langcode][0]['value'] . ' term:' . $term2->tid); - $this->assertNoText($node->title[$this->langcode][0]['value'], t('Article node not found with search filtering by term 2.')); + $this->drupalGet('search/node/' . $node->title . ' term:' . $term2->tid); + $this->assertNoText($node->title, t('Article node not found with search filtering by term 2.')); } } === modified file 'modules/tracker/tracker.test' --- modules/tracker/tracker.test 2010-01-07 05:23:51 +0000 +++ modules/tracker/tracker.test 2010-01-08 20:30:07 +0000 @@ -32,17 +32,17 @@ class TrackerTest extends DrupalWebTestC $this->drupalLogin($this->user); $unpublished = $this->drupalCreateNode(array( - 'title' => array(LANGUAGE_NONE => array(array('value' => $this->randomName(8)))), + 'title' =>$this->randomName(8), 'status' => 0, )); $published = $this->drupalCreateNode(array( - 'title' => array(LANGUAGE_NONE => array(array('value' => $this->randomName(8)))), + 'title' => $this->randomName(8), 'status' => 1, )); $this->drupalGet('tracker'); - $this->assertNoText($unpublished->title[LANGUAGE_NONE][0]['value'], t('Unpublished node do not show up in the tracker listing.')); - $this->assertText($published->title[LANGUAGE_NONE][0]['value'], t('Published node show up in the tracker listing.')); + $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->assertLink(t('My recent content'), 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' => array(LANGUAGE_NONE => array(array('value' => $this->randomName(8)))), + 'title' => $this->randomName(8), 'uid' => $this->user->uid, 'status' => 0, )); $my_published = $this->drupalCreateNode(array( - 'title' => array(LANGUAGE_NONE => array(array('value' => $this->randomName(8)))), + 'title' => $this->randomName(8), 'uid' => $this->user->uid, 'status' => 1, )); $other_published_no_comment = $this->drupalCreateNode(array( - 'title' => array(LANGUAGE_NONE => array(array('value' => $this->randomName(8)))), + 'title' => $this->randomName(8), 'uid' => $this->other_user->uid, 'status' => 1, )); $other_published_my_comment = $this->drupalCreateNode(array( - 'title' => array(LANGUAGE_NONE => array(array('value' => $this->randomName(8)))), + 'title' => $this->randomName(8), 'uid' => $this->other_user->uid, 'status' => 1, )); @@ -79,17 +79,17 @@ 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[LANGUAGE_NONE][0]['value'], t("Unpublished nodes do not show up in the users's tracker listing.")); - $this->assertText($my_published->title[LANGUAGE_NONE][0]['value'], t("Published nodes show up in the user's tracker listing.")); - $this->assertNoText($other_published_no_comment->title[LANGUAGE_NONE][0]['value'], t("Other user's nodes do not show up in the user's tracker listing.")); - $this->assertText($other_published_my_comment->title[LANGUAGE_NONE][0]['value'], t("Nodes that the user has commented on appear in the user's tracker listing.")); + $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.")); // Verify that unpublished comments are removed from the tracker. $admin_user = $this->drupalCreateUser(array('administer comments', 'access user profiles')); $this->drupalLogin($admin_user); $this->drupalPost('comment/1/edit', array('status' => COMMENT_NOT_PUBLISHED), t('Save')); $this->drupalGet('user/' . $this->user->uid . '/track'); - $this->assertNoText($other_published_my_comment->title[LANGUAGE_NONE][0]['value'], 'Unpublished comments are not counted on the tracker listing.'); + $this->assertNoText($other_published_my_comment->title, 'Unpublished comments are not counted on the tracker listing.'); } /** @@ -99,11 +99,11 @@ class TrackerTest extends DrupalWebTestC $this->drupalLogin($this->user); $edit = array( - 'title' => array(LANGUAGE_NONE => array(array('value' => $this->randomName(8)))), + 'title' => $this->randomName(8), ); $node = $this->drupalCreateNode($edit); - $title = $edit['title'][LANGUAGE_NONE][0]['value']; + $title = $edit['title']; $this->drupalGet('tracker'); $this->assertPattern('/' . $title . '.*new/', t('New nodes are flagged as such in the tracker listing.')); @@ -170,7 +170,7 @@ class TrackerTest extends DrupalWebTestC for ($i = 1; $i <= 3; $i++) { $edits[$i] = array( 'comment' => 2, - 'title' => array(LANGUAGE_NONE => array(array('value' => $this->randomName()))), + 'title' => $this->randomName(), ); $nodes[$i] = $this->drupalCreateNode($edits[$i]); } @@ -200,7 +200,7 @@ class TrackerTest extends DrupalWebTestC // Assert that all node titles are displayed. foreach ($nodes as $i => $node) { - $this->assertText($node->title[LANGUAGE_NONE][0]['value'], t('Node @i is displayed on the tracker listing pages.', array('@i' => $i))); + $this->assertText($node->title, 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')); @@ -211,7 +211,7 @@ class TrackerTest extends DrupalWebTestC // Assert that all node titles are displayed. foreach ($nodes as $i => $node) { - $this->assertText($node->title[LANGUAGE_NONE][0]['value'], t('Node @i is displayed on the tracker listing pages.', array('@i' => $i))); + $this->assertText($node->title, 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.')); } @@ -225,12 +225,12 @@ class TrackerTest extends DrupalWebTestC $node = $this->drupalCreateNode(array( 'comment' => 2, - 'title' => array(LANGUAGE_NONE => array(array('value' => $this->randomName()))), + 'title' => $this->randomName(), )); // Assert that the node is displayed. $this->drupalGet('tracker'); - $this->assertText($node->title[LANGUAGE_NONE][0]['value'], t('Node is displayed on the tracker listing pages.')); + $this->assertText($node->title, t('Node is displayed on the tracker listing pages.')); // Unpublish the node and ensure that it's no longer displayed. $edit = array( === modified file 'modules/translation/translation.module' --- modules/translation/translation.module 2010-01-08 07:36:53 +0000 +++ modules/translation/translation.module 2010-01-08 20:30:07 +0000 @@ -229,7 +229,7 @@ function translation_node_prepare($node) if (!empty($source_node->tnid)) { $translations = translation_node_get_translations($source_node->tnid); if (isset($translations[$_GET['language']])) { - 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_NONE][0]['value'], '%language' => $language_list[$_GET['language']]->name, '%type' => $node->type)), 'error'); + drupal_set_message(t('A translation of %title in %language already exists, a new %type will be created instead of a translation.', array('%title' => $source_node->title, '%language' => $language_list[$_GET['language']]->name, '%type' => $node->type)), 'error'); return; } } === modified file 'modules/translation/translation.pages.inc' --- modules/translation/translation.pages.inc 2009-12-02 19:26:21 +0000 +++ modules/translation/translation.pages.inc 2010-01-08 20:30:07 +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[LANGUAGE_NONE][0]['value'], 'node/' . $translation_node->nid); + $title = l($translation_node->title, '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[LANGUAGE_NONE][0]['value'])), PASS_THROUGH); + drupal_set_title(t('Translations of %title', array('%title' => $node->title)), PASS_THROUGH); $build['translation_node_overview'] = array( '#theme' => 'table', === modified file 'modules/translation/translation.test' --- modules/translation/translation.test 2009-12-02 19:26:21 +0000 +++ modules/translation/translation.test 2010-01-08 20:30:07 +0000 @@ -60,10 +60,10 @@ class TranslationTestCase extends Drupal // to return to the page then resubmitting the form without a refresh. $edit = array(); $langcode = LANGUAGE_NONE; - $edit["title[$langcode][0][value]"] = $this->randomName(); + $edit["title"] = $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[$langcode][0][value]"]); + $duplicate = $this->drupalGetNodeByTitle($edit["title"]); $this->assertEqual($duplicate->tnid, 0, t('The node does not have a tnid.')); // Update original and mark translation as outdated. @@ -129,7 +129,7 @@ class TranslationTestCase extends Drupal function createPage($title, $body, $language) { $edit = array(); $langcode = LANGUAGE_NONE; - $edit["title[$langcode][0][value]"] = $title; + $edit["title"] = $title; $edit["body[$langcode][0][value]"] = $body; $edit['language'] = $language; $this->drupalPost('node/add/page', $edit, t('Save')); @@ -155,7 +155,7 @@ class TranslationTestCase extends Drupal $edit = array(); $langcode = LANGUAGE_NONE; - $edit["title[$langcode][0][value]"] = $title; + $edit["title"] = $title; $edit["body[$language][0][value]"] = $body; $this->drupalPost(NULL, $edit, t('Save')); $this->assertRaw(t('Page %title has been created.', array('%title' => $title)), t('Translation created.')); === modified file 'modules/trigger/trigger.test' --- modules/trigger/trigger.test 2010-01-07 05:23:51 +0000 +++ modules/trigger/trigger.test 2010-01-08 20:30:07 +0000 @@ -38,14 +38,14 @@ class TriggerContentTestCase extends Dru $this->drupalLogin($web_user); $edit = array(); $langcode = LANGUAGE_NONE; - $edit["title[$langcode][0][value]"] = '!SimpleTest test node! ' . $this->randomName(10); + $edit["title"] = '!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[$langcode][0][value]"])), t('Make sure the page has actually been created')); + $this->assertRaw(t('!post %title has been created.', array('!post' => 'Page', '%title' => $edit["title"])), t('Make sure the page has actually been created')); // Action should have been fired. - $loaded_node = $this->drupalGetNodeByTitle($edit["title[$langcode][0][value]"]);; + $loaded_node = $this->drupalGetNodeByTitle($edit["title"]);; $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