=== modified file 'modules/blog/blog.test' --- modules/blog/blog.test 2009-12-03 20:21:50 +0000 +++ modules/blog/blog.test 2010-01-03 09:43:42 +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->assertText(t('Home ' . $crumb . ' Blogs ' . $crumb . ' @name' . $quote . 's blog', array('@name' => format_username($node_user))), t('Breadcrumbs were displayed')); + $this->assertTitle($node->title . ' | 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[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(); + $edit['title'] = 'node/' . $node->nid; $langcode = 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[$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 2009-12-02 19:26:21 +0000 +++ modules/book/book.admin.inc 2010-01-03 09:53:34 +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( @@ -125,19 +125,17 @@ function book_admin_edit_submit($form, & // Update the title if changed. 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 2009-12-29 04:23:53 +0000 +++ modules/book/book.module 2010-01-03 09:43:53 +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-03 09:54:14 +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-03 09:54:36 +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'; @@ -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 = 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[$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.module' --- modules/comment/comment.module 2009-12-26 16:50:08 +0000 +++ modules/comment/comment.module 2010-01-03 09:44:02 +0000 @@ -1692,7 +1692,7 @@ function comment_form($form, &$form_stat 'comment' => '', 'cid' => NULL, 'pid' => NULL, - 'language' => LANGUAGE_NONE, + 'language' => '', 'uid' => 0, ); $comment = (object) $comment; === modified file 'modules/comment/comment.pages.inc' --- modules/comment/comment.pages.inc 2009-12-27 03:43:45 +0000 +++ modules/comment/comment.pages.inc 2010-01-03 09:44:11 +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 2009-12-04 16:49:45 +0000 +++ modules/comment/comment.tokens.inc 2010-01-03 09:44:23 +0000 @@ -209,8 +209,7 @@ function comment_tokens($type, $tokens, case 'node': $node = node_load($comment->nid); - $title = $node->title[LANGUAGE_NONE][0]['value']; - $replacements[$original] = $sanitize ? filter_xss($title) : $title; + $replacements[$original] = $sanitize ? filter_xss($node->title) : $node->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-03 09:44:33 +0000 @@ -265,8 +265,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. @@ -320,19 +319,19 @@ class DBLogTestCase extends DrupalWebTes * @return array Content. */ private function getContent($type) { - $langcode = LANGUAGE_NONE; 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), ); break; default: + $langcode = LANGUAGE_NONE; $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.module' --- modules/field/field.module 2010-01-02 18:50:51 +0000 +++ modules/field/field.module 2010-01-03 10:01:20 +0000 @@ -70,6 +70,13 @@ module_load_include('inc', 'field', 'fie define('FIELD_CARDINALITY_UNLIMITED', -1); /** + * The language code assigned to untranslatable fields. + * + * Defined by ISO639-2 for "No linguistic content / Not applicable". + */ +define('LANGUAGE_NONE', 'zxx'); + +/** * TODO */ define('FIELD_BEHAVIOR_NONE', 0x0001); === modified file 'modules/field/field.multilingual.inc' --- modules/field/field.multilingual.inc 2009-12-04 16:49:45 +0000 +++ modules/field/field.multilingual.inc 2010-01-03 09:45:36 +0000 @@ -71,7 +71,7 @@ function field_multilingual_available_la /** * Return available content languages. * - * The languages that may be associated to fields include LANGUAGE_NONE. + * The languages that may be associated to fields include FIELD_LANGAUGE_NONE. * * @return * An array of language codes. @@ -132,6 +132,12 @@ function field_multilingual_valid_langua if (in_array($langcode, $enabled_languages)) { return $langcode; } + // @todo Currently, node language neutral code is an empty string. Node passes + // $node->language as language parameter to field_attach_form(). We might + // want to unify the two "language neutral" language codes. + if ($langcode === '') { + return LANGUAGE_NONE; + } global $language; $langcode = $default ? language_default('language') : $language->language; if (in_array($langcode, $enabled_languages)) { === 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-03 09:59:06 +0000 @@ -88,9 +88,8 @@ class FileFieldTestCase extends DrupalWe * Upload a file to a node. */ 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, ); @@ -346,8 +345,7 @@ class FileFieldValidateTestCase extends $test_file = $this->getTestFile('text'); // 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 +362,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-03 09:46:42 +0000 @@ -289,14 +289,14 @@ class FilterAdminTestCase extends Drupal $text = $body . '' . $extra_text . ''; $edit = array(); + $edit['title'] = $this->randomName(); $langcode = LANGUAGE_NONE; - $edit["title[$langcode][0][value]"] = $this->randomName(); $edit["body[$langcode][0][value]"] = $text; $edit["body[$langcode][0][value_format]"] = $filtered; $this->drupalPost('node/add/page', $edit, t('Save')); - $this->assertRaw(t('Page %title has been created.', array('%title' => $edit["title[$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 2009-12-26 16:50:08 +0000 +++ modules/forum/forum.module 2010-01-03 09:46:54 +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, @@ -677,6 +677,13 @@ 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 2009-12-02 19:26:21 +0000 +++ modules/forum/forum.test 2010-01-03 09:59:19 +0000 @@ -265,7 +265,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, ); @@ -340,27 +340,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(); + $edit['title'] = 'node/' . $node->nid; $langcode = LANGUAGE_NONE; - $edit["title[$langcode][0][value]"] = 'node/' . $node->nid; $edit["body[$langcode][0][value]"] = $this->randomName(256); // Assume the topic is initially associated with $forum. $edit["taxonomy_forums[$langcode]"] = $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( @@ -372,7 +372,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.install' --- modules/locale/locale.install 2009-12-10 15:39:42 +0000 +++ modules/locale/locale.install 2010-01-03 09:41:37 +0000 @@ -33,10 +33,9 @@ function locale_install() { */ /** - * Add context field and allow longer location. + * Allow longer location. */ function locale_update_7000() { - db_add_field('locales_source', 'context', array('type' => 'varchar', 'length' => 255, 'not null' => TRUE, 'default' => '')); db_drop_index('locales_source', 'source'); db_add_index('locales_source', 'source_context', array(array('source', 30), 'context')); db_change_field('locales_source', 'location', 'location', array('type' => 'text', 'size' => 'big', 'not null' => FALSE)); === modified file 'modules/locale/locale.module' --- modules/locale/locale.module 2009-12-23 13:28:45 +0000 +++ modules/locale/locale.module 2010-01-03 09:47:16 +0000 @@ -421,7 +421,7 @@ function locale_form_alter(&$form, &$for '#type' => 'select', '#title' => t('Language'), '#default_value' => (isset($form['#node']->language) ? $form['#node']->language : ''), - '#options' => array(LANGUAGE_NONE => t('Language neutral')) + locale_language_list('name'), + '#options' => array('' => t('Language neutral')) + locale_language_list('name'), ); } // Node type without language selector: assign the default for new nodes === modified file 'modules/locale/locale.test' --- modules/locale/locale.test 2009-12-26 16:50:08 +0000 +++ modules/locale/locale.test 2010-01-03 09:47:25 +0000 @@ -1278,11 +1278,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(); } @@ -1389,7 +1389,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, ); === modified file 'modules/menu/menu.module' --- modules/menu/menu.module 2009-12-14 20:38:15 +0000 +++ modules/menu/menu.module 2010-01-03 09:48:17 +0000 @@ -492,7 +492,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']); + $item['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-03 10:01:20 +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')); } === modified file 'modules/node/node.admin.inc' --- modules/node/node.admin.inc 2009-12-04 16:49:45 +0000 +++ modules/node/node.admin.inc 2010-01-03 09:48:36 +0000 @@ -108,7 +108,7 @@ function node_filters() { } // Language filter if there is a list of languages if ($languages = module_invoke('locale', 'language_list')) { - $languages = array(LANGUAGE_NONE => t('Language neutral')) + $languages; + $languages = array('' => t('Language neutral')) + $languages; $filters['language'] = array( 'title' => t('language'), 'options' => array( @@ -169,7 +169,7 @@ function node_filter_form() { $value = $value->name; } elseif ($type == 'language') { - $value = $value == LANGUAGE_NONE ? t('Language neutral') : module_invoke('locale', 'language_name', $value); + $value = empty($value) ? t('Language neutral') : module_invoke('locale', 'language_name', $value); } else { $value = $filters[$type]['options'][$value]; @@ -356,7 +356,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']++; @@ -431,7 +431,7 @@ function node_admin_nodes() { // Enable language column if translation module is enabled // or if we have any node with language. - $multilanguage = (module_exists('translation') || db_query("SELECT COUNT(*) FROM {node} WHERE language <> :language", array(':language' => LANGUAGE_NONE))->fetchField()); + $multilanguage = (module_exists('translation') || db_query("SELECT COUNT(*) FROM {node} WHERE language <> ''")->fetchField()); // Build the sortable table header. $header = array( @@ -477,7 +477,7 @@ function node_admin_nodes() { $destination = drupal_get_destination(); $options = array(); foreach ($nodes as $node) { - $l_options = $node->language != LANGUAGE_NONE ? array('language' => $languages[$node->language]) : array(); + $l_options = !empty($node->language) ? array('language' => $languages[$node->language]) : array(); $options[$node->nid] = array( 'title' => array( 'data' => array( @@ -494,7 +494,7 @@ function node_admin_nodes() { 'changed' => format_date($node->changed, 'short'), ); if ($multilanguage) { - $options[$node->nid]['language'] = $node->language == LANGUAGE_NONE ? t('Language neutral') : t($languages[$node->language]->name); + $options[$node->nid]['language'] = empty($node->language) ? t('Language neutral') : t($languages[$node->language]->name); } // Build a list of all the accessible operations for the current node. $operations = array(); === modified file 'modules/node/node.install' --- modules/node/node.install 2009-12-04 16:49:45 +0000 +++ modules/node/node.install 2010-01-03 09:48:49 +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,6 @@ function node_update_7006(&$context) { 'vid' => $revision->vid, 'type' => $revision->type, ); - $node->title[LANGUAGE_NONE][0]['value'] = $revision->title; if (!empty($revision->teaser) && $revision->teaser != text_summary($revision->body)) { $node->body[LANGUAGE_NONE][0]['summary'] = $revision->teaser; } @@ -566,16 +565,6 @@ function node_update_7008() { } /** - * Convert node languages from the empty string to LANGUAGE_NONE. - */ -function node_update_7009() { - db_update('node') - ->fields(array('language' => LANGUAGE_NONE)) - ->condition('language', '') - ->execute(); -} - -/** * @} End of "defgroup updates-6.x-to-7.x" * The next series of updates should start at 8000. */ === modified file 'modules/node/node.pages.inc' --- modules/node/node.pages.inc 2009-12-31 13:35:23 +0000 +++ modules/node/node.pages.inc 2010-01-03 09:49:17 +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); } @@ -62,7 +62,7 @@ function node_add($type) { // If a node type has been specified, validate its existence. if (isset($types[$type])) { // Initialize settings: - $node = (object)array('uid' => $user->uid, 'name' => (isset($user->name) ? $user->name : ''), 'type' => $type, 'language' => LANGUAGE_NONE); + $node = (object)array('uid' => $user->uid, 'name' => (isset($user->name) ? $user->name : ''), 'type' => $type, 'language' => ''); drupal_set_title(t('Create @name', array('@name' => $types[$type]->name)), PASS_THROUGH); $output = drupal_get_form($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; @@ -420,8 +423,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); @@ -471,8 +474,8 @@ 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'])), - 'node/' . $node->nid, + t('Are you sure you want to delete %title?', array('%title' => $node->title)), + isset($_GET['destination']) ? $_GET['destination'] : 'node/' . $node->nid, t('This action cannot be undone.'), t('Delete'), t('Cancel') @@ -486,8 +489,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'] = ''; @@ -497,7 +500,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)); @@ -559,8 +562,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'; } @@ -573,8 +576,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 2009-12-29 19:14:27 +0000 +++ modules/node/node.test 2010-01-03 09:49:24 +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,16 +187,15 @@ class PageEditTestCase extends DrupalWeb */ function testPageEdit() { $langcode = LANGUAGE_NONE; - $title_key = "title[$langcode][0][value]"; $body_key = "body[$langcode][0][value]"; // Create node to edit. $edit = array(); - $edit[$title_key] = $this->randomName(8); + $edit['title'] = $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_key]); + $node = $this->drupalGetNodeByTitle($edit['title']); $this->assertTrue($node, t('Node found in database.')); // Check that "edit" link points to correct page. @@ -209,18 +208,18 @@ class PageEditTestCase extends DrupalWeb $active = '' . t('(active tab)') . ''; $link_text = t('!local-task-title !active', array('!local-task-title' => t('Edit'), '!active' => $active)); $this->assertText(strip_tags($link_text), 0, t('Edit tab found and marked active.')); - $this->assertFieldByName($title_key, $edit[$title_key], t('Title field displayed.')); + $this->assertFieldByName('title', $edit['title'], 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_key] = $this->randomName(8); + $edit['title'] = $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_key], t('Title displayed.')); + $this->assertText($edit['title'], t('Title displayed.')); $this->assertText($edit[$body_key], t('Body displayed.')); // Login as a second administrator user. @@ -229,13 +228,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,22 +268,21 @@ class PagePreviewTestCase extends Drupal */ function testPagePreview() { $langcode = 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_key] = $this->randomName(8); + $edit['title'] = $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_key], t('Title displayed.')); + $this->assertText($edit['title'], 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_key, $edit[$title_key], t('Title field displayed.')); + $this->assertFieldByName('title', $edit['title'], t('Title field displayed.')); $this->assertFieldByName($body_key, $edit[$body_key], t('Body field displayed.')); } @@ -293,25 +291,24 @@ class PagePreviewTestCase extends Drupal */ function testPagePreviewWithRevisions() { $langcode = 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_key] = $this->randomName(8); + $edit['title'] = $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_key], t('Title displayed.')); + $this->assertText($edit['title'], 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_key, $edit[$title_key], t('Title field displayed.')); + $this->assertFieldByName('title', $edit['title'], t('Title field displayed.')); $this->assertFieldByName($body_key, $edit[$body_key], t('Body field displayed.')); // Check that the log field has the correct value. @@ -342,16 +339,16 @@ class NodeCreationTestCase extends Drupa function testNodeCreation() { // Create a node. $edit = array(); + $edit['title'] = $this->randomName(8); $langcode = 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[$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.')); } @@ -483,21 +480,18 @@ class NodeTitleXSSTestCase extends Drupa $this->drupalLogin($web_user); $xss = ''; - $title = $xss . $this->randomName(); - $langcode = LANGUAGE_NONE; + $edit = array( - "title[$langcode][0][value]" => $title, + 'title' => $xss . $this->randomName(), ); - $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)))); - $node = $this->drupalCreateNode($settings); + $node = $this->drupalCreateNode($edit); $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'); @@ -566,13 +560,13 @@ class NodePostSettingsTestCase extends D // Create a node. $edit = array(); + $edit['title'] = $this->randomName(8); $langcode = 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[$langcode][0][value]"]); + $node = $this->drupalGetNodeByTitle($edit['title']); $this->assertRaw('<span class="submitted">', t('Post information is displayed.')); } @@ -588,13 +582,13 @@ class NodePostSettingsTestCase extends D // Create a node. $edit = array(); + $edit['title'] = $this->randomName(8); $langcode = 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[$langcode][0][value]"]); + $node = $this->drupalGetNodeByTitle($edit['title']); $this->assertNoRaw('<span class="submitted">', t('Post information is not displayed.')); } } @@ -833,7 +827,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', === modified file 'modules/node/node.tokens.inc' --- modules/node/node.tokens.inc 2009-12-04 16:49:45 +0000 +++ modules/node/node.tokens.inc 2010-01-03 09:49:33 +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/node.tpl.php' --- modules/node/node.tpl.php 2009-12-26 16:50:08 +0000 +++ modules/node/node.tpl.php 2010-01-03 09:41:38 +0000 @@ -80,7 +80,7 @@ <?php endif; ?> <?php if (!$page): ?> - <h2<?php print $title_attributes; ?>><a href="<?php print $node_url; ?>"><?php print $node_title; ?></a></h2> + <h2<?php print $title_attributes; ?><a href="<?php print $node_url; ?>"><?php print $title; ?></a></h2> <?php endif; ?> <?php if ($display_submitted || !empty($content['links']['terms'])): ?> === modified file 'modules/path/path.admin.inc' --- modules/path/path.admin.inc 2010-01-03 00:44:53 +0000 +++ modules/path/path.admin.inc 2010-01-03 10:01:20 +0000 @@ -16,7 +16,7 @@ function path_admin_overview($keys = NUL // Add the filter form above the overview table. $build['path_admin_filter_form'] = drupal_get_form('path_admin_filter_form', $keys); // Enable language column if locale is enabled or if we have any alias with language - $alias_exists = (bool) db_query_range('SELECT 1 FROM {url_alias} WHERE language <> :language', 0, 1, array(':language' => LANGUAGE_NONE))->fetchField(); + $alias_exists = (bool) db_query_range('SELECT 1 FROM {url_alias} WHERE language <> :language', 0, 1, array(':language' => ''))->fetchField(); $multilanguage = (module_exists('locale') || $alias_exists); $header = array( @@ -94,7 +94,7 @@ function path_admin_edit($path = array() * @see path_admin_form_validate() * @see path_admin_form_submit() */ -function path_admin_form($form, &$form_state, $path = array('source' => '', 'alias' => '', 'language' => LANGUAGE_NONE, 'pid' => NULL)) { +function path_admin_form($form, &$form_state, $path = array('source' => '', 'alias' => '', 'language' => '', 'pid' => NULL)) { $form['source'] = array( '#type' => 'textfield', '#title' => t('Existing system path'), @@ -151,7 +151,7 @@ function path_admin_form_validate($form, $alias = $form_state['values']['alias']; $pid = isset($form_state['values']['pid']) ? $form_state['values']['pid'] : 0; // Language is only set if locale module is enabled, otherwise save for all languages. - $language = isset($form_state['values']['language']) ? $form_state['values']['language'] : LANGUAGE_NONE; + $language = isset($form_state['values']['language']) ? $form_state['values']['language'] : ''; $has_alias = db_query("SELECT COUNT(alias) FROM {url_alias} WHERE pid <> :pid AND alias = :alias AND language = :language", array( ':pid' => $pid, === modified file 'modules/path/path.module' --- modules/path/path.module 2009-12-14 20:38:15 +0000 +++ modules/path/path.module 2010-01-03 09:49:57 +0000 @@ -100,7 +100,7 @@ function path_form_alter(&$form, $form_s $path = array(); if (!empty($form['#node']->nid)) { $conditions = array('source' => 'node/' . $form['#node']->nid); - if ($form['#node']->language != LANGUAGE_NONE) { + if (!empty($form['#node']->language)) { $conditions['language'] = $form['#node']->language; } $path = path_load($conditions); @@ -112,7 +112,7 @@ function path_form_alter(&$form, $form_s 'pid' => NULL, 'source' => isset($form['#node']->nid) ? 'node/' . $form['#node']->nid : NULL, 'alias' => '', - 'language' => isset($form['#node']->language) ? $form['#node']->language : LANGUAGE_NONE, + 'language' => isset($form['#node']->language) ? $form['#node']->language : '', ); $form['path'] = array( @@ -190,7 +190,7 @@ function path_node_insert($node) { if (!empty($path['alias'])) { // Ensure fields for programmatic executions. $path['source'] = 'node/' . $node->nid; - $path['language'] = isset($node->language) ? $node->language : LANGUAGE_NONE; + $path['language'] = isset($node->language) ? $node->language : ''; path_save($path); } } @@ -211,7 +211,7 @@ function path_node_update($node) { if (!empty($path['alias'])) { // Ensure fields for programmatic executions. $path['source'] = 'node/' . $node->nid; - $path['language'] = isset($node->language) ? $node->language : LANGUAGE_NONE; + $path['language'] = isset($node->language) ? $node->language : ''; path_save($path); } } @@ -239,7 +239,7 @@ function path_form_taxonomy_form_term_al 'pid' => NULL, 'source' => isset($form['#term']['tid']) ? 'taxonomy/term/' . $form['#term']['tid'] : NULL, 'alias' => '', - 'language' => LANGUAGE_NONE, + 'language' => '', ); $form['identification']['path'] = array( '#access' => user_access('create url aliases') || user_access('administer url aliases'), @@ -271,7 +271,7 @@ function path_taxonomy_term_insert($term if (!empty($path['alias'])) { // Ensure fields for programmatic executions. $path['source'] = 'taxonomy/term/' . $term->tid; - $path['language'] = LANGUAGE_NONE; + $path['language'] = ''; path_save($path); } } @@ -292,7 +292,7 @@ function path_taxonomy_term_update($term if (!empty($path['alias'])) { // Ensure fields for programmatic executions. $path['source'] = 'taxonomy/term/' . $term->tid; - $path['language'] = LANGUAGE_NONE; + $path['language'] = ''; path_save($path); } } === modified file 'modules/path/path.test' --- modules/path/path.test 2009-12-09 19:22:04 +0000 +++ modules/path/path.test 2010-01-03 09:43: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,16 +270,15 @@ 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'); $this->clickLink(t('add translation')); $edit = array(); + $edit['title'] = $this->randomName(); $langcode = 'fr'; $edit["body[$langcode][0][value]"] = $this->randomName(); - $langcode = LANGUAGE_NONE; - $edit["title[$langcode][0][value]"] = $this->randomName(); $edit['path[alias]'] = $this->randomName(); $this->drupalPost(NULL, $edit, t('Save')); @@ -287,12 +286,13 @@ class PathLanguageTestCase extends Drupa drupal_lookup_path('wipe'); // Ensure the node was created. - $french_node = $this->drupalGetNodeByTitle($edit["title[$langcode][0][value]"]); + // Check to make sure the node was created. + $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 2009-12-03 15:33:42 +0000 +++ modules/php/php.test 2010-01-03 09:50:05 +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', t('PHP code isn\'t displayed.')); === modified file 'modules/poll/poll.module' --- modules/poll/poll.module 2010-01-02 23:30:53 +0000 +++ modules/poll/poll.module 2010-01-03 10:01:20 +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-03 09:59:34 +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-03 09:59:57 +0000 @@ -57,9 +57,8 @@ class PollTestCase extends DrupalWebTest $already_submitted_choices = array_slice($choices, 0, $index); $new_choices = array_values(array_slice($choices, $index, $max_new_choices)); - $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; @@ -332,9 +331,8 @@ class PollJSAddChoice extends DrupalWebT $web_user = $this->drupalCreateUser(array('create poll content', 'access content')); $this->drupalLogin($web_user); $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 2009-12-02 19:26:21 +0000 +++ modules/search/search.api.php 2010-01-03 10:00:11 +0000 @@ -191,7 +191,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, @@ -267,7 +267,7 @@ function hook_update_index() { node_build_content($node, 'search_index'); $node->rendered = drupal_render($node->content); - $text = '<h1>' . check_plain($node->title[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-02 10:45:34 +0000 +++ modules/search/search.test 2010-01-03 10:01:20 +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.')); @@ -354,7 +354,7 @@ class SearchRankingTestCase extends Drup // Create nodes for testing. foreach ($node_ranks as $node_rank) { - $settings = array('type' => 'page', 'title' => array(LANGUAGE_NONE => array(array('value' => 'Drupal rocks'))), 'body' => array(LANGUAGE_NONE => array(array('value' => "Drupal's search rocks")))); + $settings = array('type' => 'page', 'title' => 'Drupal rocks', 'body' => array(LANGUAGE_NONE => array(array('value' => "Drupal's search rocks")))); foreach (array(0, 1) as $num) { if ($num == 1) { switch ($node_rank) { @@ -536,7 +536,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($edit_comment['subject'], t('Comment subject found in search results.')); === modified file 'modules/simpletest/drupal_web_test_case.php' --- modules/simpletest/drupal_web_test_case.php 2010-01-02 18:56:20 +0000 +++ modules/simpletest/drupal_web_test_case.php 2010-01-03 10:01:20 +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, @@ -750,7 +750,6 @@ class DrupalWebTestCase extends DrupalTe 'type' => 'page', 'revisions' => NULL, 'taxonomy' => NULL, - 'language' => LANGUAGE_NONE, ); // Use the original node's created time for existing nodes. @@ -775,7 +774,8 @@ class DrupalWebTestCase extends DrupalTe 'value' => $this->randomName(32), 'format' => filter_default_format(), ); - $settings['body'][$settings['language']][0] += $body; + $langcode = !empty($settings['language']) ? $settings['language'] : LANGUAGE_NONE; + $settings['body'][$langcode][0] += $body; $node = (object) $settings; node_save($node); === 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-03 10:00:30 +0000 @@ -38,7 +38,11 @@ function statistics_node_tracker() { ); } - drupal_set_title($node->title[LANGUAGE_NONE][0]['value']); + if (empty($rows)) { + $rows[] = array(array('data' => t('No statistics available.'), 'colspan' => 4)); + } + + drupal_set_title($node->title); $build['statistics_table'] = array( '#theme' => 'table', '#header' => $header, === modified file 'modules/system/system.api.php' --- modules/system/system.api.php 2009-12-31 13:22:35 +0000 +++ modules/system/system.api.php 2010-01-03 09:51:00 +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, ); === modified file 'modules/system/system.install' --- modules/system/system.install 2009-12-24 08:21:30 +0000 +++ modules/system/system.install 2010-01-03 09:51:08 +0000 @@ -2709,16 +2709,6 @@ function system_update_7047() { } /** - * Convert path languages from the empty string to LANGUAGE_NONE. - */ -function system_update_7048() { - db_update('url_alias') - ->fields(array('language' => LANGUAGE_NONE)) - ->condition('language', '') - ->execute(); -} - -/** * @} End of "defgroup updates-6.x-to-7.x" * The next series of updates should start at 8000. */ === modified file 'modules/system/system.test' --- modules/system/system.test 2009-12-24 16:54:56 +0000 +++ modules/system/system.test 2010-01-03 09:51:16 +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-03 09:51:25 +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 2009-12-10 15:39:42 +0000 +++ modules/taxonomy/taxonomy.test 2010-01-03 09:51:34 +0000 @@ -378,14 +378,14 @@ class TaxonomyTermTestCase extends Taxon // Post an article. $edit = array(); + $edit['title'] = $this->randomName(); $langcode = LANGUAGE_NONE; - $edit["title[$langcode][0][value]"] = $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.')); @@ -413,14 +413,14 @@ class TaxonomyTermTestCase extends Taxon ); $edit = array(); + $edit['title'] = $this->randomName(); $langcode = LANGUAGE_NONE; - $edit["title[$langcode][0][value]"] = $this->randomName(); $edit["body[$langcode][0][value]"] = $this->randomName(); // Insert the terms in a comma separated list. Vocabulary 1 is a // free-tagging field created by the default profile. $edit[$instance['field_name'] . "[$langcode]"] = 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')); } === modified file 'modules/tracker/tracker.test' --- modules/tracker/tracker.test 2009-12-02 19:26:21 +0000 +++ modules/tracker/tracker.test 2010-01-03 10:00:47 +0000 @@ -32,18 +32,18 @@ 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->assertLink(t('My recent content'), 0, t('User tab shows up on the global tracker page.')); + $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 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' => 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,25 +99,24 @@ class TrackerTest extends DrupalWebTestC $this->drupalLogin($this->user); $edit = array( - 'title' => array(LANGUAGE_NONE => array(array('value' => $this->randomName(8)))), + 'title' => $this->randomName(), ); - $node = $this->drupalCreateNode($edit); - $title = $edit['title'][LANGUAGE_NONE][0]['value']; + $this->drupalGet('tracker'); - $this->assertPattern('/' . $title . '.*new/', t('New nodes are flagged as such in the tracker listing.')); + $this->assertPattern('/' . $edit['title'] . '.*new/', t('New nodes are flagged as such in the tracker listing.')); $this->drupalGet('node/' . $node->nid); $this->drupalGet('tracker'); - $this->assertNoPattern('/' . $title . '.*new/', t('Visited nodes are not flagged as new.')); + $this->assertNoPattern('/' . $edit['title'] . '.*new/', t('Visited nodes are not flagged as new.')); $this->drupalLogin($this->other_user); $this->drupalGet('tracker'); - $this->assertPattern('/' . $title . '.*new/', t('For another user, new nodes are flagged as such in the tracker listing.')); + $this->assertPattern('/' . $edit['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('/' . $title . '.*new/', t('For another user, visited nodes are not flagged as new.')); + $this->assertNoPattern('/' . $edit['title'] . '.*new/', t('For another user, visited nodes are not flagged as new.')); } /** @@ -128,7 +127,7 @@ class TrackerTest extends DrupalWebTestC $node = $this->drupalCreateNode(array( 'comment' => 2, - 'title' => array(LANGUAGE_NONE => array(array('value' => $this->randomName(8)))), + 'title' => $this->randomName(), )); // Add a comment to the page. @@ -170,7 +169,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 +199,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 +210,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 +224,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 2009-12-29 04:23:53 +0000 +++ modules/translation/translation.module 2010-01-03 09:51:43 +0000 @@ -78,7 +78,7 @@ function translation_menu() { * all languages). */ function _translation_tab_access($node) { - if ($node->language != LANGUAGE_NONE && translation_supported_type($node->type)) { + if (!empty($node->language) && translation_supported_type($node->type)) { return user_access('translate content'); } return FALSE; @@ -134,7 +134,7 @@ function translation_form_alter(&$form, // Disable languages for existing translations, so it is not possible to switch this // node to some language which is already in the translation set. Also remove the // language neutral option. - unset($form['language']['#options'][LANGUAGE_NONE]); + unset($form['language']['#options']['']); foreach (translation_node_get_translations($node->tnid) as $translation) { if ($translation->nid != $node->nid) { unset($form['language']['#options'][$translation->language]); @@ -213,7 +213,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_NONE][0]['value'], '%language' => $languages[$language]->name, '%type' => $node->type)), 'error'); + drupal_set_message(t('A translation of %title in %language already exists, a new %type will be created instead of a translation.', array('%title' => $source_node->title, '%language' => $languages[$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-03 10:01:01 +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-03 09:57:11 +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 = 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[$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. @@ -128,8 +128,8 @@ class TranslationTestCase extends Drupal */ function createPage($title, $body, $language) { $edit = array(); + $edit['title'] = $title; $langcode = 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')); @@ -154,8 +154,8 @@ class TranslationTestCase extends Drupal $this->drupalGet('node/add/page', array('query' => array('translation' => $nid, 'language' => $language))); $edit = array(); + $edit['title'] = $title; $langcode = LANGUAGE_NONE; - $edit["title[$langcode][0][value]"] = $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 2009-12-02 19:26:21 +0000 +++ modules/trigger/trigger.test 2010-01-03 09:56:50 +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 = 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[$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 === modified file 'themes/garland/node.tpl.php' --- themes/garland/node.tpl.php 2009-12-06 01:00:27 +0000 +++ themes/garland/node.tpl.php 2010-01-03 09:41:38 +0000 @@ -10,7 +10,7 @@ <?php print $user_picture; ?> <?php if (!$page): ?> - <h2<?php print $title_attributes; ?>><a href="<?php print $node_url; ?>"><?php print $node_title; ?></a></h2> + <h2<?php print $title_attributes; ?>><a href="<?php print $node_url; ?>"><?php print $title; ?></a></h2> <?php endif; ?> <?php if ($display_submitted): ?>