Commit b3265dbe authored by webchick's avatar webchick

#557292 by peximo, plach, catch, and yched: Convert node title to Field API.

parent 64a1a0d6
......@@ -253,7 +253,7 @@ EOF;
// Post 5 articles.
for ($i = 0; $i < 5; $i++) {
$edit = array();
$edit['title'] = $this->randomName();
$edit["title[$langcode][0][value]"] = $this->randomName();
$edit["body[$langcode][0][value]"] = $this->randomName();
$this->drupalPost('node/add/article', $edit, t('Save'));
}
......
......@@ -138,29 +138,29 @@ class BlogTestCase extends DrupalWebTestCase {
// View blog node.
$this->drupalGet('node/' . $node->nid);
$this->assertResponse(200);
$this->assertTitle($node->title . ' | Drupal', t('Blog node was displayed'));
$this->assertTitle($node->title[FIELD_LANGUAGE_NONE][0]['value'] . ' | Drupal', t('Blog node was displayed'));
$this->assertText(t('Home ' . $crumb . ' Blogs ' . $crumb . ' @name' . $quote . 's blog', array('@name' => $node_user->name)), t('Breadcrumbs were displayed'));
// View blog edit node.
$this->drupalGet('node/' . $node->nid . '/edit');
$this->assertResponse($response);
if ($response == 200) {
$this->assertTitle('Edit Blog entry ' . $node->title . ' | Drupal', t('Blog edit node was displayed'));
$this->assertTitle('Edit Blog entry ' . $node->title[FIELD_LANGUAGE_NONE][0]['value'] . ' | Drupal', t('Blog edit node was displayed'));
}
if ($response == 200) {
// Edit blog node.
$edit = array();
$edit['title'] = 'node/' . $node->nid;
$langcode = FIELD_LANGUAGE_NONE;
$edit["title[$langcode][0][value]"] = 'node/' . $node->nid;
$edit["body[$langcode][0][value]"] = $this->randomName(256);
$this->drupalPost('node/' . $node->nid . '/edit', $edit, t('Save'));
$this->assertRaw(t('Blog entry %title has been updated.', array('%title' => $edit['title'])), t('Blog node was edited'));
$this->assertRaw(t('Blog entry %title has been updated.', array('%title' => $edit["title[$langcode][0][value]"])), t('Blog node was edited'));
// Delete blog node.
$this->drupalPost('node/' . $node->nid . '/delete', array(), t('Delete'));
$this->assertResponse($response);
$this->assertRaw(t('Blog entry %title has been deleted.', array('%title' => $edit['title'])), t('Blog node was deleted'));
$this->assertRaw(t('Blog entry %title has been deleted.', array('%title' => $edit["title[$langcode][0][value]"])), t('Blog node was deleted'));
}
}
......
......@@ -78,7 +78,7 @@ function book_admin_settings_validate($form, &$form_state) {
* @ingroup forms.
*/
function book_admin_edit($form, $form_state, $node) {
drupal_set_title($node->title);
drupal_set_title($node->title[FIELD_LANGUAGE_NONE][0]['value']);
$form['#node'] = $node;
_book_admin_table($node, $form);
$form['save'] = array(
......@@ -131,17 +131,19 @@ function book_admin_edit_submit($form, &$form_state) {
// Update the title if changed.
if ($row['title']['#default_value'] != $values['title']) {
$node = node_load($values['nid'], FALSE);
$node->title = $values['title'];
$langcode = FIELD_LANGUAGE_NONE;
$node->title = array($langcode => array(array('value' => $values['title'])));
$node->book['link_title'] = $values['title'];
$node->revision = 1;
$node->log = t('Title changed from %original to %current.', array('%original' => $node->title, '%current' => $values['title']));
$node->log = t('Title changed from %original to %current.', array('%original' => $node->title[$langcode][0]['value'], '%current' => $values['title']));
node_save($node);
watchdog('content', 'book: updated %title.', array('%title' => $node->title), WATCHDOG_NOTICE, l(t('view'), 'node/' . $node->nid));
watchdog('content', 'book: updated %title.', array('%title' => $node->title[$langcode][0]['value']), WATCHDOG_NOTICE, l(t('view'), 'node/' . $node->nid));
}
}
}
drupal_set_message(t('Updated book %title.', array('%title' => $form['#node']->title)));
drupal_set_message(t('Updated book %title.', array('%title' => $form['#node']->title[$langcode][0]['value'])));
}
/**
......
......@@ -477,7 +477,7 @@ function _book_add_form_elements(&$form, $node) {
if (isset($node->nid) && ($nid == $node->book['original_bid']) && ($node->book['parent_depth_limit'] == 0)) {
// This is the top level node in a maximum depth book and thus cannot be moved.
$options[$node->nid] = $node->title;
$options[$node->nid] = $node->title[FIELD_LANGUAGE_NONE][0]['value'];
}
else {
foreach (book_get_books() as $book) {
......@@ -526,7 +526,7 @@ function _book_update_outline($node) {
$new = empty($node->book['mlid']);
$node->book['link_path'] = 'node/' . $node->nid;
$node->book['link_title'] = $node->title;
$node->book['link_title'] = $node->title[FIELD_LANGUAGE_NONE][0]['value'];
$node->book['parent_mismatch'] = FALSE; // The normal case.
if ($node->book['bid'] == $node->nid) {
......@@ -882,7 +882,7 @@ function book_form_node_delete_confirm_alter(&$form, $form_state) {
if (isset($node->book) && $node->book['has_children']) {
$form['book_warning'] = array(
'#markup' => '<p>' . t('%title is part of a book outline, and has associated child pages. If you proceed with deletion, the child pages will be relocated automatically.', array('%title' => $node->title)) . '</p>',
'#markup' => '<p>' . t('%title is part of a book outline, and has associated child pages. If you proceed with deletion, the child pages will be relocated automatically.', array('%title' => $node->title[FIELD_LANGUAGE_NONE][0]['value'])) . '</p>',
'#weight' => -10,
);
}
......@@ -1103,7 +1103,7 @@ function book_node_export($node, $children = '') {
*/
function template_preprocess_book_node_export_html(&$variables) {
$variables['depth'] = $variables['node']->book['depth'];
$variables['title'] = check_plain($variables['node']->title);
$variables['title'] = check_plain($variables['node']->title[FIELD_LANGUAGE_NONE][0]['value']);
$variables['content'] = $variables['node']->rendered;
}
......
......@@ -79,7 +79,7 @@ function book_export_html($nid) {
$contents = book_export_traverse($tree, 'book_node_export');
}
return theme('book_export_html', array('title' => $node->title, 'contents' => $contents, 'depth' => $node->book['depth']));
return theme('book_export_html', array('title' => $node->title[FIELD_LANGUAGE_NONE][0]['value'], 'contents' => $contents, 'depth' => $node->book['depth']));
}
else {
drupal_access_denied();
......@@ -90,7 +90,7 @@ function book_export_html($nid) {
* Menu callback; show the outline form for a single node.
*/
function book_outline($node) {
drupal_set_title($node->title);
drupal_set_title($node->title[FIELD_LANGUAGE_NONE][0]['value']);
return drupal_get_form('book_outline_form', $node);
}
......@@ -188,7 +188,7 @@ function book_outline_form_submit($form, &$form_state) {
*/
function book_remove_form($form, &$form_state, $node) {
$form['#node'] = $node;
$title = array('%title' => $node->title);
$title = array('%title' => $node->title[FIELD_LANGUAGE_NONE][0]['value']);
if ($node->book['has_children']) {
$description = t('%title has associated child pages, which will be relocated automatically to maintain their connection to the book. To recreate the hierarchy (as it was before removing this page), %title may be added again using the Outline tab, and each of its former child pages will need to be relocated manually.', $title);
......
......@@ -110,7 +110,7 @@ class BookTestCase extends DrupalWebTestCase {
// Check previous, up, and next links.
if ($previous) {
$this->assertRaw(l('‹ ' . $previous->title, 'node/' . $previous->nid, array('attributes' => array('class' => array('page-previous'), 'title' => t('Go to previous page')))), t('Previous page link found.'));
$this->assertRaw(l('‹ ' . $previous->title[FIELD_LANGUAGE_NONE][0]['value'], 'node/' . $previous->nid, array('attributes' => array('class' => array('page-previous'), 'title' => t('Go to previous page')))), t('Previous page link found.'));
}
if ($up) {
......@@ -118,7 +118,7 @@ class BookTestCase extends DrupalWebTestCase {
}
if ($next) {
$this->assertRaw(l($next->title . ' ›', 'node/' . $next->nid, array('attributes' => array('class' => array('page-next'), 'title' => t('Go to next page')))), t('Next page link found.'));
$this->assertRaw(l($next->title[FIELD_LANGUAGE_NONE][0]['value'] . ' ›', 'node/' . $next->nid, array('attributes' => array('class' => array('page-next'), 'title' => t('Go to next page')))), t('Next page link found.'));
}
// Compute the expected breadcrumb.
......@@ -140,7 +140,7 @@ class BookTestCase extends DrupalWebTestCase {
// Check printer friendly version.
$this->drupalGet('book/export/html/' . $node->nid);
$this->assertText($node->title, t('Printer friendly title found.'));
$this->assertText($node->title[FIELD_LANGUAGE_NONE][0]['value'], t('Printer friendly title found.'));
$this->assertRaw(check_markup($node->body[FIELD_LANGUAGE_NONE][0]['value'], $node->body[FIELD_LANGUAGE_NONE][0]['format']), t('Printer friendly body found.'));
$number++;
......@@ -154,7 +154,7 @@ class BookTestCase extends DrupalWebTestCase {
function generateOutlinePattern($nodes) {
$outline = '';
foreach ($nodes as $node) {
$outline .= '(node\/' . $node->nid . ')(.*?)(' . $node->title . ')(.*?)';
$outline .= '(node\/' . $node->nid . ')(.*?)(' . $node->title[FIELD_LANGUAGE_NONE][0]['value'] . ')(.*?)';
}
return '/<div id="book-navigation-' . $this->book->nid . '"(.*?)<ul(.*?)' . $outline . '<\/ul>/s';
......@@ -172,8 +172,8 @@ class BookTestCase extends DrupalWebTestCase {
static $number = 0; // Used to ensure that when sorted nodes stay in same order.
$edit = array();
$edit['title'] = $number . ' - SimpleTest test node ' . $this->randomName(10);
$langcode = FIELD_LANGUAGE_NONE;
$edit["title[$langcode][0][value]"] = $number . ' - SimpleTest test node ' . $this->randomName(10);
$edit["body[$langcode][0][value]"] = 'SimpleTest test body ' . $this->randomName(32) . ' ' . $this->randomName(32);
$edit['book[bid]'] = $book_nid;
......@@ -188,7 +188,7 @@ class BookTestCase extends DrupalWebTestCase {
}
// Check to make sure the book node was created.
$node = $this->drupalGetNodeByTitle($edit['title']);
$node = $this->drupalGetNodeByTitle($edit["title[$langcode][0][value]"]);
$this->assertNotNull(($node === FALSE ? NULL : $node), t('Book node found in database.'));
$number++;
......
......@@ -29,7 +29,7 @@
*/
function comment_reply($node, $pid = NULL) {
// Set the breadcrumb trail.
drupal_set_breadcrumb(array(l(t('Home'), NULL), l($node->title, 'node/' . $node->nid)));
drupal_set_breadcrumb(array(l(t('Home'), NULL), l($node->title[FIELD_LANGUAGE_NONE][0]['value'], 'node/' . $node->nid)));
$op = isset($_POST['op']) ? $_POST['op'] : '';
$build = array();
......
......@@ -209,7 +209,8 @@ function comment_tokens($type, $tokens, array $data = array(), array $options =
case 'node':
$node = node_load($comment->nid);
$replacements[$original] = $sanitize ? filter_xss($node->title) : $node->title;
$title = $node->title[FIELD_LANGUAGE_NONE][0]['value'];
$replacements[$original] = $sanitize ? filter_xss($title) : $title;
break;
}
}
......
......@@ -266,7 +266,8 @@ class DBLogTestCase extends DrupalWebTestCase {
// Create node using form to generate add content event (which is not triggered by drupalCreateNode).
$edit = $this->getContent($type);
$title = $edit['title'];
$langcode = FIELD_LANGUAGE_NONE;
$title = $edit["title[$langcode][0][value]"];
$this->drupalPost('node/add/' . $type, $edit, t('Save'));
$this->assertResponse(200);
// Retrieve node object.
......@@ -320,19 +321,19 @@ class DBLogTestCase extends DrupalWebTestCase {
* @return array Content.
*/
private function getContent($type) {
$langcode = FIELD_LANGUAGE_NONE;
switch ($type) {
case 'poll':
$content = array(
'title' => $this->randomName(8),
"title[$langcode][0][value]" => $this->randomName(8),
'choice[new:0][chtext]' => $this->randomName(32),
'choice[new:1][chtext]' => $this->randomName(32),
);
break;
default:
$langcode = FIELD_LANGUAGE_NONE;
$content = array(
'title' => $this->randomName(8),
"title[$langcode][0][value]" => $this->randomName(8),
"body[$langcode][0][value]" => $this->randomName(32),
);
break;
......
......@@ -87,8 +87,9 @@ class FileFieldTestCase extends DrupalWebTestCase {
* Upload a file to a node.
*/
function uploadNodeFile($file, $field_name, $nid_or_type, $new_revision = TRUE) {
$langcode = FIELD_LANGUAGE_NONE;
$edit = array(
'title' => $this->randomName(),
"title[$langcode][0][value]" => $this->randomName(),
'revision' => (string) (int) $new_revision,
);
......@@ -344,7 +345,8 @@ class FileFieldValidateTestCase extends FileFieldTestCase {
$test_file = $this->getTestFile('text');
// Try to post a new node without uploading a file.
$edit = array('title' => $this->randomName());
$langcode = FIELD_LANGUAGE_NONE;
$edit = array("title[$langcode][0][value]" => $this->randomName());
$this->drupalPost('node/add/' . $type_name, $edit, t('Save'));
$this->assertRaw(t('!title field is required.', array('!title' => $instance['label'])), t('Node save failed when required file field was empty.'));
......@@ -361,7 +363,7 @@ class FileFieldValidateTestCase extends FileFieldTestCase {
$this->createFileField($field_name, $type_name, array('cardinality' => FIELD_CARDINALITY_UNLIMITED), array('required' => '1'));
// Try to post a new node without uploading a file in the multivalue field.
$edit = array('title' => $this->randomName());
$edit = array("title[$langcode][0][value]" => $this->randomName());
$this->drupalPost('node/add/' . $type_name, $edit, t('Save'));
$this->assertRaw(t('!title field is required.', array('!title' => $instance['label'])), t('Node save failed when required multiple value file field was empty.'));
......
......@@ -274,14 +274,14 @@ class FilterAdminTestCase extends DrupalWebTestCase {
$text = $body . '<random>' . $extra_text . '</random>';
$edit = array();
$edit['title'] = $this->randomName();
$langcode = FIELD_LANGUAGE_NONE;
$edit["title[$langcode][0][value]"] = $this->randomName();
$edit["body[$langcode][0][value]"] = $text;
$edit["body[$langcode][0][value_format]"] = $filtered;
$this->drupalPost('node/add/page', $edit, t('Save'));
$this->assertRaw(t('Page %title has been created.', array('%title' => $edit['title'])), t('Filtered node created.'));
$this->assertRaw(t('Page %title has been created.', array('%title' => $edit["title[$langcode][0][value]"])), t('Filtered node created.'));
$node = $this->drupalGetNodeByTitle($edit['title']);
$node = $this->drupalGetNodeByTitle($edit["title[$langcode][0][value]"]);
$this->assertTrue($node, t('Node found in database.'));
$this->drupalGet('node/' . $node->nid);
......
......@@ -431,7 +431,7 @@ function forum_field_attach_pre_insert($obj_type, $object, $skip_fields) {
foreach ($language as $delta) {
$query->values(array(
'nid' => $object->nid,
'title' => $object->title,
'title' => $object->title[FIELD_LANGUAGE_NONE][0]['value'],
'tid' => $delta['value'],
'sticky' => $object->sticky,
'created' => $object->created,
......@@ -606,8 +606,7 @@ function forum_block_view_pre_render($elements) {
*/
function forum_form($node, $form_state) {
$type = node_type_get_type($node);
$form['title'] = array('#type' => 'textfield', '#title' => check_plain($type->title_label), '#default_value' => !empty($node->title) ? $node->title : '', '#required' => TRUE, '#weight' => -5);
if (!empty($node->nid)) {
$forum_terms = $node->taxonomy_forums;
// If editing, give option to leave shadows
......
......@@ -248,7 +248,7 @@ class ForumTestCase extends DrupalWebTestCase {
$langcode = FIELD_LANGUAGE_NONE;
$edit = array(
'title' => $title,
"title[$langcode][0][value]" => $title,
"body[$langcode][0][value]" => $body,
"taxonomy_forums[$langcode][value]" => $tid,
);
......@@ -323,27 +323,27 @@ class ForumTestCase extends DrupalWebTestCase {
// View forum node.
$this->drupalGet('node/' . $node->nid);
$this->assertResponse(200);
$this->assertTitle($node->title . ' | Drupal', t('Forum node was displayed'));
$this->assertTitle($node->title[FIELD_LANGUAGE_NONE][0]['value'] . ' | Drupal', t('Forum node was displayed'));
$this->assertText(t('Home ' . $crumb . ' Forums ' . $crumb . ' @container ' . $crumb . ' @forum', array('@container' => $this->container['name'], '@forum' => $this->forum['name'])), t('Breadcrumbs were displayed'));
// View forum edit node.
$this->drupalGet('node/' . $node->nid . '/edit');
$this->assertResponse($response);
if ($response == 200) {
$this->assertTitle('Edit Forum topic ' . $node->title . ' | Drupal', t('Forum edit node was displayed'));
$this->assertTitle('Edit Forum topic ' . $node->title[FIELD_LANGUAGE_NONE][0]['value'] . ' | Drupal', t('Forum edit node was displayed'));
}
if ($response == 200) {
// Edit forum node (including moving it to another forum).
$edit = array();
$edit['title'] = 'node/' . $node->nid;
$langcode = FIELD_LANGUAGE_NONE;
$edit["title[$langcode][0][value]"] = 'node/' . $node->nid;
$edit["body[$langcode][0][value]"] = $this->randomName(256);
// Assume the topic is initially associated with $forum.
$edit["taxonomy_forums[$langcode][value]"] = $this->root_forum['tid'];
$edit['shadow'] = TRUE;
$this->drupalPost('node/' . $node->nid . '/edit', $edit, t('Save'));
$this->assertRaw(t('Forum topic %title has been updated.', array('%title' => $edit['title'])), t('Forum node was edited'));
$this->assertRaw(t('Forum topic %title has been updated.', array('%title' => $edit["title[$langcode][0][value]"])), t('Forum node was edited'));
// Verify topic was moved to a different forum.
$forum_tid = db_query("SELECT tid FROM {forum} WHERE nid = :nid AND vid = :vid", array(
......@@ -355,7 +355,7 @@ class ForumTestCase extends DrupalWebTestCase {
// Delete forum node.
$this->drupalPost('node/' . $node->nid . '/delete', array(), t('Delete'));
$this->assertResponse($response);
$this->assertRaw(t('Forum topic %title has been deleted.', array('%title' => $edit['title'])), t('Forum node was deleted'));
$this->assertRaw(t('Forum topic %title has been deleted.', array('%title' => $edit["title[$langcode][0][value]"])), t('Forum node was deleted'));
}
}
......
......@@ -1285,11 +1285,11 @@ class LocalePathFunctionalTest extends DrupalWebTestCase {
// Confirm English language path alias works.
$this->drupalGet($english_path);
$this->assertText($node->title, t('English alias works.'));
$this->assertText($node->title[FIELD_LANGUAGE_NONE][0]['value'], t('English alias works.'));
// Confirm custom language path alias works.
$this->drupalGet($prefix . '/' . $custom_language_path);
$this->assertText($node->title, t('Custom language alias works.'));
$this->assertText($node->title[FIELD_LANGUAGE_NONE][0]['value'], t('Custom language alias works.'));
$this->drupalLogout();
}
......@@ -1395,7 +1395,7 @@ class LocaleContentFunctionalTest extends DrupalWebTestCase {
$node_body = $this->randomName();
$edit = array(
'type' => 'page',
'title' => $node_title,
'title' => array(FIELD_LANGUAGE_NONE => array(array('value' => $node_title))),
'body' => array(FIELD_LANGUAGE_NONE => array(array('value' => $node_body))),
'language' => $langcode,
);
......
......@@ -399,7 +399,7 @@ function menu_node_insert($node) {
$item['link_title'] = trim($item['link_title']);
$item['link_path'] = "node/$node->nid";
if (!$item['customized']) {
$item['options']['attributes']['title'] = trim($node->title);
$item['options']['attributes']['title'] = trim($node->title[FIELD_LANGUAGE_NONE][0]['value']);
}
if (!menu_link_save($item)) {
drupal_set_message(t('There was an error saving the menu link.'), 'error');
......@@ -421,7 +421,7 @@ function menu_node_update($node) {
$item['link_title'] = trim($item['link_title']);
$item['link_path'] = "node/$node->nid";
if (!$item['customized']) {
$item['options']['attributes']['title'] = trim($node->title);
$item['options']['attributes']['title'] = trim($node->title[FIELD_LANGUAGE_NONE][0]['value']);
}
if (!menu_link_save($item)) {
drupal_set_message(t('There was an error saving the menu link.'), 'error');
......
......@@ -315,7 +315,7 @@ class MenuTestCase extends DrupalWebTestCase {
// Verify menu link link.
$this->clickLink($title);
$title = $parent_node->title;
$title = $parent_node->title[FIELD_LANGUAGE_NONE][0]['value'];
$this->assertTitle(t("@title | Drupal", array('@title' => $title)), t('Parent menu link link target was correct'));
}
......@@ -325,7 +325,7 @@ class MenuTestCase extends DrupalWebTestCase {
// Verify menu link link.
$this->clickLink($title);
$title = $item_node->title;
$title = $item_node->title[FIELD_LANGUAGE_NONE][0]['value'];
$this->assertTitle(t("@title | Drupal", array('@title' => $title)), t('Menu link link target was correct'));
}
......
......@@ -339,7 +339,7 @@ function _node_mass_update_batch_process($nodes, $updates, &$context) {
$node = _node_mass_update_helper($nid, $updates);
// Store result for post-processing in the finished callback.
$context['results'][] = l($node->title, 'node/' . $node->nid);
$context['results'][] = l($node->title[FIELD_LANGUAGE_NONE][0]['value'], 'node/' . $node->nid);
// Update our progress information.
$context['sandbox']['progress']++;
......
......@@ -438,9 +438,9 @@ function node_update_7006(&$context) {
if (!isset($context['total'])) {
// Initial invocation.
// Re-save node types to create body field instances.
// Re-save node types to create title and body field instances.
foreach ($node_types as $type => $info) {
if ($info->has_body) {
if ($info->has_title || $info->has_body) {
node_type_save($info);
}
}
......@@ -485,6 +485,7 @@ function node_update_7006(&$context) {
'vid' => $revision->vid,
'type' => $revision->type,
);
$node->title[FIELD_LANGUAGE_NONE][0]['value'] = $revision->title;
if (!empty($revision->teaser) && $revision->teaser != text_summary($revision->body)) {
$node->body[FIELD_LANGUAGE_NONE][0]['summary'] = $revision->teaser;
}
......
This diff is collapsed.
......@@ -12,7 +12,7 @@
*/
function node_page_edit($node) {
$type_name = node_type_get_name($node);
drupal_set_title(t('<em>Edit @type</em> @title', array('@type' => $type_name, '@title' => $node->title)), PASS_THROUGH);
drupal_set_title(t('<em>Edit @type</em> @title', array('@type' => $type_name, '@title' => $node->title[FIELD_LANGUAGE_NONE][0]['value'])), PASS_THROUGH);
return drupal_get_form($node->type . '_node_form', $node);
}
......@@ -150,9 +150,6 @@ function node_form($form, &$form_state, $node) {
if ($extra = node_invoke($node, 'form', $form_state)) {
$form = array_merge_recursive($form, $extra);
}
if (!isset($form['title']['#weight'])) {
$form['title']['#weight'] = -5;
}
$form['#node'] = $node;
......@@ -414,8 +411,8 @@ function node_form_submit($form, &$form_state) {
$insert = empty($node->nid);
node_save($node);
$node_link = l(t('view'), 'node/' . $node->nid);
$watchdog_args = array('@type' => $node->type, '%title' => $node->title);
$t_args = array('@type' => node_type_get_name($node), '%title' => $node->title);
$watchdog_args = array('@type' => $node->type, '%title' => $node->title[FIELD_LANGUAGE_NONE][0]['value']);
$t_args = array('@type' => node_type_get_name($node), '%title' => $node->title[FIELD_LANGUAGE_NONE][0]['value']);
if ($insert) {
watchdog('content', '@type: added %title.', $watchdog_args, WATCHDOG_NOTICE, $node_link);
......@@ -464,7 +461,7 @@ function node_delete_confirm($form, &$form_state, $node) {
);
return confirm_form($form,
t('Are you sure you want to delete %title?', array('%title' => $node->title)),
t('Are you sure you want to delete %title?', array('%title' => $node->title[FIELD_LANGUAGE_NONE][0]['value'])),
isset($_GET['destination']) ? $_GET['destination'] : 'node/' . $node->nid,
t('This action cannot be undone.'),
t('Delete'),
......@@ -479,8 +476,8 @@ function node_delete_confirm_submit($form, &$form_state) {
if ($form_state['values']['confirm']) {
$node = node_load($form_state['values']['nid']);
node_delete($form_state['values']['nid']);
watchdog('content', '@type: deleted %title.', array('@type' => $node->type, '%title' => $node->title));
drupal_set_message(t('@type %title has been deleted.', array('@type' => node_type_get_name($node), '%title' => $node->title)));
watchdog('content', '@type: deleted %title.', array('@type' => $node->type, '%title' => $node->title[FIELD_LANGUAGE_NONE][0]['value']));
drupal_set_message(t('@type %title has been deleted.', array('@type' => node_type_get_name($node), '%title' => $node->title[FIELD_LANGUAGE_NONE][0]['value'])));
}
$form_state['redirect'] = '<front>';
......@@ -490,7 +487,7 @@ function node_delete_confirm_submit($form, &$form_state) {
* Generate an overview table of older revisions of a node.
*/
function node_revision_overview($node) {
drupal_set_title(t('Revisions for %title', array('%title' => $node->title)), PASS_THROUGH);
drupal_set_title(t('Revisions for %title', array('%title' => $node->title[FIELD_LANGUAGE_NONE][0]['value'])), PASS_THROUGH);
$header = array(t('Revision'), array('data' => t('Operations'), 'colspan' => 2));
......@@ -552,8 +549,8 @@ function node_revision_revert_confirm_submit($form, &$form_state) {
node_save($node_revision);
watchdog('content', '@type: reverted %title revision %revision.', array('@type' => $node_revision->type, '%title' => $node_revision->title, '%revision' => $node_revision->vid));
drupal_set_message(t('@type %title has been reverted back to the revision from %revision-date.', array('@type' => node_type_get_name($node_revision), '%title' => $node_revision->title, '%revision-date' => format_date($node_revision->revision_timestamp))));
watchdog('content', '@type: reverted %title revision %revision.', array('@type' => $node_revision->type, '%title' => $node_revision->title[FIELD_LANGUAGE_NONE][0]['value'], '%revision' => $node_revision->vid));
drupal_set_message(t('@type %title has been reverted back to the revision from %revision-date.', array('@type' => node_type_get_name($node_revision), '%title' => $node_revision->title[FIELD_LANGUAGE_NONE][0]['value'], '%revision-date' => format_date($node_revision->revision_timestamp))));
$form_state['redirect'] = 'node/' . $node_revision->nid . '/revisions';
}
......@@ -566,8 +563,8 @@ function node_revision_delete_confirm_submit($form, &$form_state) {
$node_revision = $form['#node_revision'];
node_revision_delete($node_revision->vid);
watchdog('content', '@type: deleted %title revision %revision.', array('@type' => $node_revision->type, '%title' => $node_revision->title, '%revision' => $node_revision->vid));
drupal_set_message(t('Revision from %revision-date of @type %title has been deleted.', array('%revision-date' => format_date($node_revision->revision_timestamp), '@type' => node_type_get_name($node_revision), '%title' => $node_revision->title)));
watchdog('content', '@type: deleted %title revision %revision.', array('@type' => $node_revision->type, '%title' => $node_revision->title[FIELD_LANGUAGE_NONE][0]['value'], '%revision' => $node_revision->vid));
drupal_set_message(t('Revision from %revision-date of @type %title has been deleted.', array('%revision-date' => format_date($node_revision->revision_timestamp), '@type' => node_type_get_name($node_revision), '%title' => $node_revision->title[FIELD_LANGUAGE_NONE][0]['value'])));
$form_state['redirect'] = 'node/' . $node_revision->nid;
if (db_query('SELECT COUNT(vid) FROM {node_revision} WHERE nid = :nid', array(':nid' => $node_revision->nid))->fetchField() > 1) {
$form_state['redirect'] .= '/revisions';
......
This diff is collapsed.
......@@ -134,7 +134,7 @@ function node_tokens($type, $tokens, array $data = array(), array $options = arr
break;
case 'title':
$replacements[$original] = $sanitize ? check_plain($node->title) : $node->title;
$replacements[$original] = $sanitize ? check_plain($node->title[FIELD_LANGUAGE_NONE][0]['value']) : $node->title[FIELD_LANGUAGE_NONE][0]['value'];
break;
case 'body':
......
......@@ -75,7 +75,7 @@
<?php print $user_picture; ?>
<?php if (!$page): ?>
<h2<?php print $title_attributes; ?>><a href="<?php print $node_url; ?>"><?php print $title; ?></a></h2>
<h2<?php print $title_attributes; ?>>a href="<?php print $node_url; ?>"><?php print $node_title; ?></a></h2>
<?php endif; ?>
<?php if ($display_submitted || !empty($content['links']['terms'])): ?>
......
......@@ -66,7 +66,7 @@ class PathTestCase extends DrupalWebTestCase {
// Confirm that the alias works.
$this->drupalGet($edit['dst']);
$this->assertText($node1->title, 'Alias works.');
$this->assertText($node1->title[FIELD_LANGUAGE_NONE][0]['value'], 'Alias works.');
// Change alias.
$pid = $this->getPID($edit['dst']);
......@@ -77,7 +77,7 @@ class PathTestCase extends DrupalWebTestCase {
// Confirm that the alias works.
$this->drupalGet($edit['dst']);
$this->assertText($node1->title, 'Changed alias works.');
$this->assertText($node1->title[FIELD_LANGUAGE_NONE][0]['value'], 'Changed alias works.');
// Confirm that previous alias no longer works.
$this->drupalGet($previous);
......@@ -117,7 +117,7 @@ class PathTestCase extends DrupalWebTestCase {
// Confirm that the alias works.
$this->drupalGet($edit['path']);
$this->assertText($node1->title, 'Alias works.');
$this->assertText($node1->title[FIELD_LANGUAGE_NONE][0]['value'], 'Alias works.');
// Change alias.
$previous = $edit['path'];
......@@ -126,11 +126,11 @@ class PathTestCase extends DrupalWebTestCase {
// Confirm that the alias works.
$this->drupalGet($edit['path']);
$this->assertText($node1->title, 'Changed alias works.');
$this->assertText($node1->title[FIELD_LANGUAGE_NONE][0]['value'], 'Changed alias works.');
// Make sure that previous alias no longer works.
$this->drupalGet($previous);
$this->assertNoText($node1->title, 'Previous alias no longer works.');
$this->assertNoText($node1->title[FIELD_LANGUAGE_NONE][0]['value'], 'Previous alias no longer works.');
$this->assertResponse(404);
// Create second test node.
......@@ -208,14 +208,14 @@ class PathLanguageTestCase extends DrupalWebTestCase {
// Confirm that the alias works.
$this->drupalGet($edit['path']);
$this->assertText($english_node->title, 'Alias works.');
$this->assertText($english_node->title[FIELD_LANGUAGE_NONE][0]['value'], 'Alias works.');
// Translate the node into French.
$this->drupalGet('node/' . $english_node->nid . '/translate');
$this->clickLink(t('add translation'));
$edit = array();
$edit['title'] = $this->randomName();
$langcode = FIELD_LANGUAGE_NONE;
$edit["title[$langcode][0][value]"] = $this->randomName();
$edit["body[$langcode][0][value]"] = $this->randomName();
$edit['path'] = $this->randomName();
$this->drupalPost(NULL, $edit, t('Save'));
......@@ -225,12 +225,12 @@ class PathLanguageTestCase extends DrupalWebTestCase {
// Ensure the node was created.
// Check to make sure the node was created.
$french_node = $this->drupalGetNodeByTitle($edit['title']);
$french_node = $this->drupalGetNodeByTitle($edit["title[$langcode][0][value]"]);
$this->assertTrue(($french_node), 'Node found in database.');
// Confirm that the alias works.
$this->drupalGet('fr/' . $edit['path']);
$this->assertText($french_node->title, 'Alias for French translation works.');
$this->assertText($french_node->title[FIELD_LANGUAGE_NONE][0]['value'], 'Alias for French translation works.');
// Confirm that the alias is returned by url().
$languages = language_list();
......
......@@ -67,7 +67,7 @@ class PHPFilterTestCase extends PHPTestCase {
$langcode = FIELD_LANGUAGE_NONE;
$edit["body[$langcode][0][value_format]"] = $this->php_code_format;
$this->drupalPost('node/' . $node->nid . '/edit', $edit, t('Save'));
$this->assertRaw(t('Page %title has been updated.', array('%title' => $node->title)), t('PHP code filter turned on.'));
$this->assertRaw(t('Page %title has been updated.', array('%title' => $node->title[FIELD_LANGUAGE_NONE][0]['value'])), t('PHP code filter turned on.'));
// Make sure that the PHP code shows up as text.
$this->assertNoText('print', t('PHP code isn\'t displayed.'));
......
......@@ -222,14 +222,6 @@ function poll_form($node, $form_state) {
'#cache' => TRUE,
);
$form['title'] = array(
'#type' => 'textfield',
'#title' => check_plain($type->title_label),
'#required' => TRUE,
'#default_value' => $node->title,
'#weight' => -5,
);
if (isset($form_state['choice_count'])) {
$choice_count = $form_state['choice_count'];
}
......@@ -716,7 +708,7 @@ function poll_vote($form, &$form_state) {
function template_preprocess_poll_vote(&$variables) {
$form = $variables['form'];
$variables['choice'] = drupal_render($form['choice']);
$variables['title'] = check_plain($form['#node']->title);
$variables['title'] = check_plain($form['#node']->title[FIELD_LANGUAGE_NONE][0]['value']);
$variables['vote'] = drupal_render($form['vote']);
$variables['rest'] = drupal_render_children($form);
$variables['block'] = $form['#block'];
......@@ -748,7 +740,7 @@ function poll_view_results($node, $build_mode, $block = FALSE) {
}
}
return theme('poll_results', array('raw_title' => $node->title, 'results' => $poll_results, 'votes' => $total_votes, 'raw_links' => isset($node->links) ? $node->links : array(), 'block' => $block, 'nid' => $node->nid, 'vote' => isset($node->vote) ? $node->vote : NULL));
return theme('poll_results', array('raw_title' => $node->title[FIELD_LANGUAGE_NONE][0]['value'], 'results' => $poll_results, 'votes' => $total_votes, 'raw_links' => isset($node->links) ? $node->links : array(), 'block' => $block, 'nid' => $node->nid, 'vote' => isset($node->vote) ? $node->vote : NULL));
}
......
......@@ -51,7 +51,7 @@ function poll_page() {
*/
function poll_votes($node) {
$votes_per_page = 20;