Commit 147bb138 authored by webchick's avatar webchick

#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. :\
parent 364238c5
......@@ -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'));
}
......
......@@ -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'));
}
}
......
......@@ -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)));
}
/**
......
......@@ -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;
}
......
......@@ -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);
......
......@@ -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++;
......
......@@ -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();
......
......@@ -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;
}
......
......@@ -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;
......
......@@ -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,
......
......@@ -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.'));
......
......@@ -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);
......
......@@ -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;
......
......@@ -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'));
}
}
......
......@@ -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);
......
......@@ -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');
......
......@@ -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'));
......
......@@ -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))),
......
......@@ -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;
}
......
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[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';
......
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[LANGUAGE_NONE][0]['value']) : $node->title[LANGUAGE_NONE][0]['value'];
$replacements[$original] = $sanitize ? check_plain($node->title) : $node->title;
break;
case 'body':
......
......@@ -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.');
}
}
......@@ -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');
......
......@@ -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."));
......
......@@ -222,6 +222,14 @@ function poll_form($node, &$form_state) {
$form_state['cache'] = TRUE;