summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorAngie Byron <webchick@24967.no-reply.drupal.org>2010-01-09 21:54:01 +0000
committerAngie Byron <webchick@24967.no-reply.drupal.org>2010-01-09 21:54:01 +0000
commit147bb1389a18eca73015390cc46a5fe03abfcb88 (patch)
treec5798ac604e5fd2ded01f15db2f0e422b4077abb /modules
parent364238c585cb3c2f64b99a385c577f174cdf1f39 (diff)
downloadbrdo-147bb1389a18eca73015390cc46a5fe03abfcb88.tar.gz
brdo-147bb1389a18eca73015390cc46a5fe03abfcb88.tar.bz2
#571654 follow-up by chx, peximo, plach, sun, et al:
Roll-back of node titles as fields. The Entity Translation module in contrib can add this back, but for everyone else it creates a *huge* WTF. Apologies for how late this is coming, but better now than post-alpha. :\
Diffstat (limited to 'modules')
-rw-r--r--modules/aggregator/aggregator.test2
-rw-r--r--modules/blog/blog.test10
-rw-r--r--modules/book/book.admin.inc10
-rw-r--r--modules/book/book.module8
-rw-r--r--modules/book/book.pages.inc6
-rw-r--r--modules/book/book.test12
-rw-r--r--modules/comment/comment.pages.inc2
-rw-r--r--modules/comment/comment.tokens.inc2
-rw-r--r--modules/dblog/dblog.test6
-rw-r--r--modules/field/field.api.php2
-rw-r--r--modules/file/tests/file.test6
-rw-r--r--modules/filter/filter.test6
-rw-r--r--modules/forum/forum.module10
-rw-r--r--modules/forum/forum.test12
-rw-r--r--modules/locale/locale.test10
-rw-r--r--modules/menu/menu.module2
-rw-r--r--modules/menu/menu.test6
-rw-r--r--modules/node/node.admin.inc4
-rw-r--r--modules/node/node.install6
-rw-r--r--modules/node/node.module132
-rw-r--r--modules/node/node.pages.inc25
-rw-r--r--modules/node/node.test79
-rw-r--r--modules/node/node.tokens.inc2
-rw-r--r--modules/node/tests/node_test_exception.module2
-rw-r--r--modules/path/path.test18
-rw-r--r--modules/php/php.test2
-rw-r--r--modules/poll/poll.module12
-rw-r--r--modules/poll/poll.pages.inc4
-rw-r--r--modules/poll/poll.test4
-rw-r--r--modules/search/search.api.php4
-rw-r--r--modules/search/search.test14
-rw-r--r--modules/simpletest/drupal_web_test_case.php2
-rw-r--r--modules/statistics/statistics.pages.inc2
-rw-r--r--modules/statistics/statistics.test2
-rw-r--r--modules/system/system.api.php4
-rw-r--r--modules/system/system.test24
-rw-r--r--modules/system/system.tokens.inc2
-rw-r--r--modules/taxonomy/taxonomy.test20
-rw-r--r--modules/tracker/tracker.test40
-rw-r--r--modules/translation/translation.module2
-rw-r--r--modules/translation/translation.pages.inc4
-rw-r--r--modules/translation/translation.test8
-rw-r--r--modules/trigger/trigger.test6
43 files changed, 255 insertions, 281 deletions
diff --git a/modules/aggregator/aggregator.test b/modules/aggregator/aggregator.test
index 92c2c10b8..101e11f1d 100644
--- a/modules/aggregator/aggregator.test
+++ b/modules/aggregator/aggregator.test
@@ -253,7 +253,7 @@ EOF;
// Post 5 articles.
for ($i = 0; $i < 5; $i++) {
$edit = array();
- $edit["title[$langcode][0][value]"] = $this->randomName();
+ $edit['title'] = $this->randomName();
$edit["body[$langcode][0][value]"] = $this->randomName();
$this->drupalPost('node/add/article', $edit, t('Save'));
}
diff --git a/modules/blog/blog.test b/modules/blog/blog.test
index 09d51a9fe..f640cfef1 100644
--- a/modules/blog/blog.test
+++ b/modules/blog/blog.test
@@ -138,29 +138,29 @@ class BlogTestCase extends DrupalWebTestCase {
// View blog node.
$this->drupalGet('node/' . $node->nid);
$this->assertResponse(200);
- $this->assertTitle($node->title[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'));
}
}
diff --git a/modules/book/book.admin.inc b/modules/book/book.admin.inc
index fe0a30d6d..618cf840e 100644
--- a/modules/book/book.admin.inc
+++ b/modules/book/book.admin.inc
@@ -72,7 +72,7 @@ function book_admin_settings_validate($form, &$form_state) {
* @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, &$form_state) {
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)));
}
/**
diff --git a/modules/book/book.module b/modules/book/book.module
index f1a2faf67..0a9ce59a0 100644
--- a/modules/book/book.module
+++ b/modules/book/book.module
@@ -511,7 +511,7 @@ function _book_add_form_elements(&$form, &$form_state, $node) {
if (isset($node->nid) && ($nid == $node->book['original_bid']) && ($node->book['parent_depth_limit'] == 0)) {
// This is the top level node in a maximum depth book and thus cannot be moved.
- $options[$node->nid] = $node->title[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_alter(&$form, $form_state) {
if (isset($node->book) && $node->book['has_children']) {
$form['book_warning'] = array(
- '#markup' => '<p>' . t('%title is part of a book outline, and has associated child pages. If you proceed with deletion, the child pages will be relocated automatically.', array('%title' => $node->title[LANGUAGE_NONE][0]['value'])) . '</p>',
+ '#markup' => '<p>' . t('%title is part of a book outline, and has associated child pages. If you proceed with deletion, the child pages will be relocated automatically.', array('%title' => $node->title)) . '</p>',
'#weight' => -10,
);
}
@@ -1139,7 +1139,7 @@ function book_node_export($node, $children = '') {
*/
function template_preprocess_book_node_export_html(&$variables) {
$variables['depth'] = $variables['node']->book['depth'];
- $variables['title'] = check_plain($variables['node']->title[LANGUAGE_NONE][0]['value']);
+ $variables['title'] = check_plain($variables['node']->title);
$variables['content'] = $variables['node']->rendered;
}
diff --git a/modules/book/book.pages.inc b/modules/book/book.pages.inc
index 4fab15465..832e1e3c5 100644
--- a/modules/book/book.pages.inc
+++ b/modules/book/book.pages.inc
@@ -79,7 +79,7 @@ function book_export_html($nid) {
$contents = book_export_traverse($tree, 'book_node_export');
}
- return theme('book_export_html', array('title' => $node->title[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, &$form_state) {
*/
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);
diff --git a/modules/book/book.test b/modules/book/book.test
index c051e73fb..d68a17ab3 100644
--- a/modules/book/book.test
+++ b/modules/book/book.test
@@ -110,7 +110,7 @@ class BookTestCase extends DrupalWebTestCase {
// Check previous, up, and next links.
if ($previous) {
- $this->assertRaw(l('‹ ' . $previous->title[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 DrupalWebTestCase {
}
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 DrupalWebTestCase {
// 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 DrupalWebTestCase {
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 '/<div id="book-navigation-' . $this->book->nid . '"(.*?)<ul(.*?)' . $outline . '<\/ul>/s';
@@ -173,7 +173,7 @@ class BookTestCase extends DrupalWebTestCase {
$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 DrupalWebTestCase {
}
// 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++;
diff --git a/modules/comment/comment.pages.inc b/modules/comment/comment.pages.inc
index 9435b8393..2ad1c77a4 100644
--- a/modules/comment/comment.pages.inc
+++ b/modules/comment/comment.pages.inc
@@ -29,7 +29,7 @@
*/
function comment_reply($node, $pid = NULL) {
// Set the breadcrumb trail.
- drupal_set_breadcrumb(array(l(t('Home'), NULL), l($node->title[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();
diff --git a/modules/comment/comment.tokens.inc b/modules/comment/comment.tokens.inc
index 60db70fab..d16eabda6 100644
--- a/modules/comment/comment.tokens.inc
+++ b/modules/comment/comment.tokens.inc
@@ -210,7 +210,7 @@ function comment_tokens($type, $tokens, array $data = array(), array $options =
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;
}
diff --git a/modules/dblog/dblog.test b/modules/dblog/dblog.test
index 23998c55e..cb06034f9 100644
--- a/modules/dblog/dblog.test
+++ b/modules/dblog/dblog.test
@@ -266,7 +266,7 @@ class DBLogTestCase extends DrupalWebTestCase {
// 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 DrupalWebTestCase {
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 DrupalWebTestCase {
default:
$content = array(
- "title[$langcode][0][value]" => $this->randomName(8),
+ "title" => $this->randomName(8),
"body[$langcode][0][value]" => $this->randomName(32),
);
break;
diff --git a/modules/field/field.api.php b/modules/field/field.api.php
index b54dd63f4..c4e364855 100644
--- a/modules/field/field.api.php
+++ b/modules/field/field.api.php
@@ -1333,7 +1333,7 @@ function hook_field_storage_pre_insert($obj_type, $object, &$skip_fields) {
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,
diff --git a/modules/file/tests/file.test b/modules/file/tests/file.test
index 64327b31d..0dc3a1c6b 100644
--- a/modules/file/tests/file.test
+++ b/modules/file/tests/file.test
@@ -90,7 +90,7 @@ class FileFieldTestCase extends DrupalWebTestCase {
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 FileFieldTestCase {
// 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 FileFieldTestCase {
$this->createFileField($field_name, $type_name, array('cardinality' => FIELD_CARDINALITY_UNLIMITED), array('required' => '1'));
// Try to post a new node without uploading a file in the multivalue field.
- $edit = array("title[$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.'));
diff --git a/modules/filter/filter.test b/modules/filter/filter.test
index 2ef6d807d..d7d82ea0d 100644
--- a/modules/filter/filter.test
+++ b/modules/filter/filter.test
@@ -290,13 +290,13 @@ class FilterAdminTestCase extends DrupalWebTestCase {
$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);
diff --git a/modules/forum/forum.module b/modules/forum/forum.module
index 1386827be..e241fd1c1 100644
--- a/modules/forum/forum.module
+++ b/modules/forum/forum.module
@@ -502,7 +502,7 @@ function forum_field_storage_pre_insert($obj_type, $object, &$skip_fields) {
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($obj_type, $object, &$skip_fields) {
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($elements) {
*/
function forum_form($node, $form_state) {
$type = node_type_get_type($node);
+ $form['title'] = array(
+ '#type' => 'textfield',
+ '#title' => check_plain($type->title_label),
+ '#default_value' => !empty($node->title) ? $node->title : '',
+ '#required' => TRUE, '#weight' => -5
+ );
if (!empty($node->nid)) {
$forum_terms = $node->taxonomy_forums;
diff --git a/modules/forum/forum.test b/modules/forum/forum.test
index 5a6b0f229..5499d4614 100644
--- a/modules/forum/forum.test
+++ b/modules/forum/forum.test
@@ -267,7 +267,7 @@ class ForumTestCase extends DrupalWebTestCase {
$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 DrupalWebTestCase {
// 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 DrupalWebTestCase {
// Delete forum node.
$this->drupalPost('node/' . $node->nid . '/delete', array(), t('Delete'));
$this->assertResponse($response);
- $this->assertRaw(t('Forum topic %title has been deleted.', array('%title' => $edit["title[$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'));
}
}
diff --git a/modules/locale/locale.test b/modules/locale/locale.test
index d0647eb71..061bf04f3 100644
--- a/modules/locale/locale.test
+++ b/modules/locale/locale.test
@@ -1340,11 +1340,11 @@ class LocalePathFunctionalTest extends DrupalWebTestCase {
// 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 extends DrupalWebTestCase {
$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 LocaleMultilingualFieldsFunctionalTest extends DrupalWebTestCase {
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 LocaleMultilingualFieldsFunctionalTest extends DrupalWebTestCase {
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);
diff --git a/modules/menu/menu.module b/modules/menu/menu.module
index 7eaac9fb8..5f203a7f6 100644
--- a/modules/menu/menu.module
+++ b/modules/menu/menu.module
@@ -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');
diff --git a/modules/menu/menu.test b/modules/menu/menu.test
index e3efe094b..51dddb071 100644
--- a/modules/menu/menu.test
+++ b/modules/menu/menu.test
@@ -317,7 +317,7 @@ class MenuTestCase extends DrupalWebTestCase {
// 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 DrupalWebTestCase {
// 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 DrupalWebTestCase {
$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'));
diff --git a/modules/node/node.admin.inc b/modules/node/node.admin.inc
index 76d72897c..b323c43bb 100644
--- a/modules/node/node.admin.inc
+++ b/modules/node/node.admin.inc
@@ -345,7 +345,7 @@ function _node_mass_update_batch_process($nodes, $updates, &$context) {
$node = _node_mass_update_helper($nid, $updates);
// Store result for post-processing in the finished callback.
- $context['results'][] = l($node->title[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))),
diff --git a/modules/node/node.install b/modules/node/node.install
index bb37a8953..9aee19f05 100644
--- a/modules/node/node.install
+++ b/modules/node/node.install
@@ -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;
}
diff --git a/modules/node/node.module b/modules/node/node.module
index 4a26e94a3..2bfa5ed8d 100644
--- a/modules/node/node.module
+++ b/modules/node/node.module
@@ -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);
+/**
+ * Implements hook_field_extra_fields().
+ */
+function node_field_extra_fields() {
+ $extra = array();
- 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,
- ),
+ 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_mode = 'full') {
$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($languages) {
*/
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(&$variables) {
$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(&$variables) {
// Make the field variables available with the appropriate language.
field_attach_preprocess('node', $node, $variables['content'], $variables);
- if (isset($variables['content']['title'])) {
- unset($variables['content']['title']);
- }
-
// Display post information only on certain node types.
if (variable_get('node_submitted_' . $node->type, TRUE)) {
$variables['display_submitted'] = TRUE;
@@ -1615,7 +1575,7 @@ function node_search_execute($keys = NULL) {
$results[] = array(
'link' => url('node/' . $item->sid, array('absolute' => TRUE)),
'type' => check_plain(node_type_get_name($node)),
- 'title' => $node->title[LANGUAGE_NONE][0]['value'],
+ 'title' => $node->title,
'user' => theme('username', array('account' => $node)),
'date' => $node->changed,
'node' => $node,
@@ -2121,7 +2081,7 @@ function node_feed($nids = FALSE, $channel = array()) {
$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 +2184,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 +2223,7 @@ function _node_index_node($node) {
unset($build['#theme']);
$node->rendered = drupal_render($build);
- $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);
@@ -2987,9 +2940,21 @@ function _node_access_rebuild_batch_finished($success, $results, $operations) {
*/
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, $context = array()) {
*/
function node_unpublish_action($node, $context = array()) {
$node->status = NODE_NOT_PUBLISHED;
- watchdog('action', 'Set @type %title to unpublished.', array('@type' => node_type_get_name($node), '%title' => $node->title[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, $context = array()) {
*/
function node_make_sticky_action($node, $context = array()) {
$node->sticky = NODE_STICKY;
- watchdog('action', 'Set @type %title to sticky.', array('@type' => node_type_get_name($node), '%title' => $node->title[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, $context = array()) {
*/
function node_make_unsticky_action($node, $context = array()) {
$node->sticky = NODE_NOT_STICKY;
- watchdog('action', 'Set @type %title to unsticky.', array('@type' => node_type_get_name($node), '%title' => $node->title[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, $context = array()) {
*/
function node_promote_action($node, $context = array()) {
$node->promote = NODE_PROMOTED;
- watchdog('action', 'Promoted @type %title to front page.', array('@type' => node_type_get_name($node), '%title' => $node->title[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, $context = array()) {
*/
function node_unpromote_action($node, $context = array()) {
$node->promote = NODE_NOT_PROMOTED;
- watchdog('action', 'Removed @type %title from front page.', array('@type' => node_type_get_name($node), '%title' => $node->title[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, $context = array()) {
*/
function node_save_action($node) {
node_save($node);
- watchdog('action', 'Saved @type %title', array('@type' => node_type_get_name($node), '%title' => $node->title[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_action($node, $context) {
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 DrupalDefaultEntityController {
// 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;
}
diff --git a/modules/node/node.pages.inc b/modules/node/node.pages.inc
index 77193ab2a..2ae471d16 100644
--- a/modules/node/node.pages.inc
+++ b/modules/node/node.pages.inc
@@ -12,7 +12,7 @@
*/
function node_page_edit($node) {
$type_name = node_type_get_name($node);
- drupal_set_title(t('<em>Edit @type</em> @title', array('@type' => $type_name, '@title' => $node->title[LANGUAGE_NONE][0]['value'])), PASS_THROUGH);
+ drupal_set_title(t('<em>Edit @type</em> @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, $node) {
if ($extra = node_invoke($node, 'form', $form_state)) {
$form = array_merge_recursive($form, $extra);
}
+ if (!isset($form['title']['#weight'])) {
+ $form['title']['#weight'] = -5;
+ }
$form['#node'] = $node;
@@ -423,8 +426,8 @@ function node_form_submit($form, &$form_state) {
$insert = empty($node->nid);
node_save($node);
$node_link = l(t('view'), 'node/' . $node->nid);
- $watchdog_args = array('@type' => $node->type, '%title' => $node->title[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, &$form_state, $node) {
);
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($form, &$form_state) {
if ($form_state['values']['confirm']) {
$node = node_load($form_state['values']['nid']);
node_delete($form_state['values']['nid']);
- watchdog('content', '@type: deleted %title.', array('@type' => $node->type, '%title' => $node->title[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'] = '<front>';
@@ -500,7 +503,7 @@ function node_delete_confirm_submit($form, &$form_state) {
* Generate an overview table of older revisions of a node.
*/
function node_revision_overview($node) {
- drupal_set_title(t('Revisions for %title', array('%title' => $node->title[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_submit($form, &$form_state) {
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_submit($form, &$form_state) {
$node_revision = $form['#node_revision'];
node_revision_delete($node_revision->vid);
- watchdog('content', '@type: deleted %title revision %revision.', array('@type' => $node_revision->type, '%title' => $node_revision->title[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';
diff --git a/modules/node/node.test b/modules/node/node.test
index f697f468d..46eb51461 100644
--- a/modules/node/node.test
+++ b/modules/node/node.test
@@ -31,15 +31,15 @@ class NodeLoadMultipleUnitTest extends DrupalWebTestCase {
// Confirm that promoted nodes appear in the default node listing.
$this->drupalGet('node');
- $this->assertText($node1->title[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 DrupalWebTestCase {
$nodes = node_load_multiple(array(1, 2, 3, 4), array('type' => 'article'));
$count = count($nodes);
$this->assertTrue($count == 3, t('@count nodes loaded', array('@count' => $count)));
- $this->assertEqual($nodes[$node1->nid]->title[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 DrupalWebTestCase {
$nodes = node_load_multiple(array(1, 2, 3, 4), array('type' => 'article'));
$count = count($nodes);
$this->assertTrue($count == 3, t('@count nodes loaded.', array('@count' => $count)));
- $this->assertEqual($nodes[$node1->nid]->title[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 DrupalWebTestCase {
// Confirm that revisions revert properly.
$this->drupalPost("node/$node->nid/revisions/{$nodes[1]->vid}/revert", array(), t('Revert'));
$this->assertRaw(t('@type %title has been reverted back to the revision from %revision-date.',
- array('@type' => 'Page', '%title' => $nodes[1]->title[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 DrupalWebTestCase {
$this->drupalPost("node/$node->nid/revisions/{$nodes[1]->vid}/delete", array(), t('Delete'));
$this->assertRaw(t('Revision from %revision-date of @type %title has been deleted.',
array('%revision-date' => format_date($nodes[1]->revision_timestamp),
- '@type' => 'Page', '%title' => $nodes[1]->title[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 DrupalWebTestCase {
*/
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 DrupalWebTestCase {
// 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 DrupalWebTestCase {
*/
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 DrupalWebTestCase {
*/
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 DrupalWebTestCase {
// 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 DrupalWebTestCase {
// 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 DrupalWebTestCase {
$xss = '<script>alert("xss")</script>';
$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 <title> 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 DrupalWebTestCase {
// 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 DrupalWebTestCase {
// 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 DrupalWebTestCase {
$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 DrupalWebTestCase {
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');
}
}
diff --git a/modules/node/node.tokens.inc b/modules/node/node.tokens.inc
index a62190dbd..72443a308 100644
--- a/modules/node/node.tokens.inc
+++ b/modules/node/node.tokens.inc
@@ -134,7 +134,7 @@ function node_tokens($type, $tokens, array $data = array(), array $options = arr
break;
case 'title':
- $replacements[$original] = $sanitize ? check_plain($node->title[LANGUAGE_NONE][0]['value']) : $node->title[LANGUAGE_NONE][0]['value'];
+ $replacements[$original] = $sanitize ? check_plain($node->title) : $node->title;
break;
case 'body':
diff --git a/modules/node/tests/node_test_exception.module b/modules/node/tests/node_test_exception.module
index c7edc8f24..6dfe18b61 100644
--- a/modules/node/tests/node_test_exception.module
+++ b/modules/node/tests/node_test_exception.module
@@ -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.');
}
}
diff --git a/modules/path/path.test b/modules/path/path.test
index 2cbb9a99f..15053ec39 100644
--- a/modules/path/path.test
+++ b/modules/path/path.test
@@ -63,7 +63,7 @@ class PathTestCase extends DrupalWebTestCase {
// 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 DrupalWebTestCase {
// 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 DrupalWebTestCase {
// 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 DrupalWebTestCase {
// 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 DrupalWebTestCase {
// 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 DrupalWebTestCase {
$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 DrupalWebTestCase {
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');
diff --git a/modules/php/php.test b/modules/php/php.test
index daffd4683..94ac64362 100644
--- a/modules/php/php.test
+++ b/modules/php/php.test
@@ -79,7 +79,7 @@ class PHPFilterTestCase extends PHPTestCase {
$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."));
diff --git a/modules/poll/poll.module b/modules/poll/poll.module
index 15eb9995d..c267cf260 100644
--- a/modules/poll/poll.module
+++ b/modules/poll/poll.module
@@ -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_mode, $block = FALSE) {
}
}
- 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));
}
diff --git a/modules/poll/poll.pages.inc b/modules/poll/poll.pages.inc
index 9cddde586..b34b94705 100644
--- a/modules/poll/poll.pages.inc
+++ b/modules/poll/poll.pages.inc
@@ -51,7 +51,7 @@ function poll_page() {
*/
function poll_votes($node) {
$votes_per_page = 20;
- drupal_set_title($node->title[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);
}
diff --git a/modules/poll/poll.test b/modules/poll/poll.test
index f96ff6595..f3bf4f378 100644
--- a/modules/poll/poll.test
+++ b/modules/poll/poll.test
@@ -59,7 +59,7 @@ class PollTestCase extends DrupalWebTestCase {
$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 DrupalWebTestCase {
$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(),
);
diff --git a/modules/search/search.api.php b/modules/search/search.api.php
index 5908c74cb..517427853 100644
--- a/modules/search/search.api.php
+++ b/modules/search/search.api.php
@@ -194,7 +194,7 @@ function hook_search_execute($keys = NULL) {
$results[] = array(
'link' => url('node/' . $item->sid, array('absolute' => TRUE)),
'type' => check_plain(node_type_get_name($node)),
- 'title' => $node->title[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);
diff --git a/modules/search/search.test b/modules/search/search.test
index 3c4f91a57..4f18e96c5 100644
--- a/modules/search/search.test
+++ b/modules/search/search.test
@@ -312,17 +312,17 @@ class SearchAdvancedSearchForm extends DrupalWebTestCase {
$this->assertNoText($this->node->title, t('Page node is not found with dummy title.'));
// Search for the title of the node with a GET query.
- $this->drupalGet('search/node/' . $this->node->title[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 DrupalWebTestCase {
'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 DrupalWebTestCase {
'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.'));
diff --git a/modules/simpletest/drupal_web_test_case.php b/modules/simpletest/drupal_web_test_case.php
index be4dbf016..7ea600145 100644
--- a/modules/simpletest/drupal_web_test_case.php
+++ b/modules/simpletest/drupal_web_test_case.php
@@ -738,7 +738,7 @@ class DrupalWebTestCase extends DrupalTestCase {
// 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,
diff --git a/modules/statistics/statistics.pages.inc b/modules/statistics/statistics.pages.inc
index 01d902932..545dc137c 100644
--- a/modules/statistics/statistics.pages.inc
+++ b/modules/statistics/statistics.pages.inc
@@ -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,
diff --git a/modules/statistics/statistics.test b/modules/statistics/statistics.test
index 83f45bd79..e8d0ae8ce 100644
--- a/modules/statistics/statistics.test
+++ b/modules/statistics/statistics.test
@@ -119,7 +119,7 @@ class StatisticsReportsTestCase extends StatisticsTestCase {
$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.'));
}
}
diff --git a/modules/system/system.api.php b/modules/system/system.api.php
index 886e7f178..9a77da925 100644
--- a/modules/system/system.api.php
+++ b/modules/system/system.api.php
@@ -1354,7 +1354,7 @@ function hook_mail($key, &$message, $params) {
'%uid' => $node->uid,
'%node_url' => url('node/' . $node->nid, array('absolute' => TRUE)),
'%node_type' => node_type_get_name($node),
- '%title' => $node->title[LANGUAGE_NONE][0]['value'],
+ '%title' => $node->title,
'%teaser' => $node->teaser,
'%body' => $node->body,
);
@@ -2953,7 +2953,7 @@ function hook_tokens($type, $tokens, array $data = array(), array $options = 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':
diff --git a/modules/system/system.test b/modules/system/system.test
index 3cfa20d1c..4626fa4e0 100644
--- a/modules/system/system.test
+++ b/modules/system/system.test
@@ -571,7 +571,7 @@ class AccessDeniedTestCase extends DrupalWebTestCase {
$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 DrupalWebTestCase {
$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 DrupalWebTestCase {
$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 DrupalWebTestCase {
$this->drupalPost('admin/config/system/site-information', array('site_404' => 'node/' . $node->nid), t('Save configuration'));
$this->drupalGet($this->randomName(10));
- $this->assertText($node->title[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 DrupalWebTestCase {
// 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 DrupalWebTestCase {
// 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 DrupalWebTestCase {
$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 DrupalWebTestCase {
$raw_tokens = array('title' => '[node:title]');
$generated = token_generate('node', $raw_tokens, array('node' => $node));
- $this->assertFalse(strcmp($generated['[node:title]'], check_plain($node->title[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.'));
}
}
diff --git a/modules/system/system.tokens.inc b/modules/system/system.tokens.inc
index 876648fb4..6d8912021 100644
--- a/modules/system/system.tokens.inc
+++ b/modules/system/system.tokens.inc
@@ -283,7 +283,7 @@ function system_tokens($type, $tokens, array $data = array(), array $options = a
case 'node':
if ($nid = $file->nid) {
$node = node_load($file->nid);
- $replacements[$original] = $sanitize ? filter_xss($node->title[LANGUAGE_NONE][0]['value']) : $node->title[LANGUAGE_NONE][0]['value'];
+ $replacements[$original] = $sanitize ? filter_xss($node->title) : $node->title;
}
break;
diff --git a/modules/taxonomy/taxonomy.test b/modules/taxonomy/taxonomy.test
index 101530350..63a77d87f 100644
--- a/modules/taxonomy/taxonomy.test
+++ b/modules/taxonomy/taxonomy.test
@@ -379,13 +379,13 @@ class TaxonomyTermTestCase extends TaxonomyWebTestCase {
// 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 TaxonomyWebTestCase {
$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 TaxonomyWebTestCase {
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.'));
}
}
diff --git a/modules/tracker/tracker.test b/modules/tracker/tracker.test
index 7f71caf0c..12dc9d48d 100644
--- a/modules/tracker/tracker.test
+++ b/modules/tracker/tracker.test
@@ -32,17 +32,17 @@ class TrackerTest extends DrupalWebTestCase {
$this->drupalLogin($this->user);
$unpublished = $this->drupalCreateNode(array(
- 'title' => 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 DrupalWebTestCase {
$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 DrupalWebTestCase {
$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 DrupalWebTestCase {
$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 DrupalWebTestCase {
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 DrupalWebTestCase {
// 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 DrupalWebTestCase {
// 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 DrupalWebTestCase {
$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(
diff --git a/modules/translation/translation.module b/modules/translation/translation.module
index 00cd1054d..2074bb63a 100644
--- a/modules/translation/translation.module
+++ b/modules/translation/translation.module
@@ -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;
}
}
diff --git a/modules/translation/translation.pages.inc b/modules/translation/translation.pages.inc
index c5d38b179..50d8849ee 100644
--- a/modules/translation/translation.pages.inc
+++ b/modules/translation/translation.pages.inc
@@ -33,7 +33,7 @@ function translation_node_overview($node) {
// Existing translation in the translation set: display status.
// We load the full node to check whether the user can edit it.
$translation_node = node_load($translations[$language->language]->nid);
- $title = l($translation_node->title[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',
diff --git a/modules/translation/translation.test b/modules/translation/translation.test
index aea57ef2b..10497427f 100644
--- a/modules/translation/translation.test
+++ b/modules/translation/translation.test
@@ -60,10 +60,10 @@ class TranslationTestCase extends DrupalWebTestCase {
// 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 DrupalWebTestCase {
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 DrupalWebTestCase {
$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.'));
diff --git a/modules/trigger/trigger.test b/modules/trigger/trigger.test
index 9bf1e5b01..5096dd805 100644
--- a/modules/trigger/trigger.test
+++ b/modules/trigger/trigger.test
@@ -38,14 +38,14 @@ class TriggerContentTestCase extends DrupalWebTestCase {
$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