Commit 268b7058 authored by webchick's avatar webchick

Issue #1616962 by fgm, rvilar, kalman.hosszu, fubhy: Replace ->title with ->label().

parent 353eb10c
......@@ -4633,8 +4633,8 @@ function _form_set_class(&$element, $class = array()) {
* // and the batch processing can continue to the next operation.
*
* $node = node_load(array('uid' => $uid, 'type' => $type));
* $context['results'][] = $node->nid . ' : ' . check_plain($node->title);
* $context['message'] = check_plain($node->title);
* $context['results'][] = $node->nid . ' : ' . check_plain($node->label());
* $context['message'] = check_plain($node->label());
* }
*
* // More advanced example: multi-step operation - load all nodes, five by five
......@@ -4653,10 +4653,10 @@ function _form_set_class(&$element, $class = array()) {
* ->execute();
* foreach ($result as $row) {
* $node = node_load($row->nid, NULL, TRUE);
* $context['results'][] = $node->nid . ' : ' . check_plain($node->title);
* $context['results'][] = $node->nid . ' : ' . check_plain($node->label());
* $context['sandbox']['progress']++;
* $context['sandbox']['current_node'] = $node->nid;
* $context['message'] = check_plain($node->title);
* $context['message'] = check_plain($node->label());
* }
* if ($context['sandbox']['progress'] != $context['sandbox']['max']) {
* $context['finished'] = $context['sandbox']['progress'] / $context['sandbox']['max'];
......
......@@ -77,7 +77,7 @@ function book_admin_settings_validate($form, &$form_state) {
* @ingroup forms
*/
function book_admin_edit($form, $form_state, Node $node) {
drupal_set_title($node->title);
drupal_set_title($node->label());
$form['#node'] = $node;
_book_admin_table($node, $form);
$form['save'] = array(
......@@ -138,12 +138,12 @@ function book_admin_edit_submit($form, &$form_state) {
$node->log = t('Title changed from %original to %current.', array('%original' => $node->title, '%current' => $values['title']));
$node->save();
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->label()), 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']->label())));
}
/**
......
......@@ -570,7 +570,7 @@ function _book_add_form_elements(&$form, &$form_state, Node $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->label();
}
else {
foreach (book_get_books() as $book) {
......@@ -639,7 +639,7 @@ function _book_update_outline(Node $node) {
$new = empty($node->book['mlid']);
$node->book['link_path'] = 'node/' . $node->nid;
$node->book['link_title'] = $node->title;
$node->book['link_title'] = $node->label();
$node->book['parent_mismatch'] = FALSE; // The normal case.
if ($node->book['bid'] == $node->nid) {
......@@ -1044,7 +1044,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->label())) . '</p>',
'#weight' => -10,
);
}
......@@ -1319,7 +1319,7 @@ function book_node_export(Node $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']->label());
$variables['content'] = $variables['node']->rendered;
}
......
......@@ -83,7 +83,7 @@ function book_export_html($nid) {
if (isset($node->book)) {
$tree = book_menu_subtree_data($node->book);
$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->label(), 'contents' => $contents, 'depth' => $node->book['depth']));
}
else {
throw new NotFoundHttpException();
......@@ -103,7 +103,7 @@ function book_export_html($nid) {
* @see book_menu()
*/
function book_outline(Node $node) {
drupal_set_title($node->title);
drupal_set_title($node->label());
return drupal_get_form('book_outline_form', $node);
}
......@@ -210,7 +210,7 @@ function book_outline_form_submit($form, &$form_state) {
*/
function book_remove_form($form, &$form_state, Node $node) {
$form['#node'] = $node;
$title = array('%title' => $node->title);
$title = array('%title' => $node->label());
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);
......
......@@ -142,15 +142,15 @@ function checkBookNode(Node $node, $nodes, $previous = FALSE, $up = FALSE, $next
// Check previous, up, and next links.
if ($previous) {
$this->assertRaw(l('<b>‹</b> ' . $previous->title, 'node/' . $previous->nid, array('html'=> TRUE, 'attributes' => array('rel' => array('prev'), 'title' => t('Go to previous page')))), t('Previous page link found.'));
$this->assertRaw(l('<b>‹</b> ' . $previous->label(), 'node/' . $previous->nid, array('html' => TRUE, 'attributes' => array('rel' => array('prev'), 'title' => t('Go to previous page')))), t('Previous page link found.'));
}
if ($up) {
$this->assertRaw(l('up', 'node/' . $up->nid, array('html'=> TRUE,'attributes' => array('title' => t('Go to parent page')))), t('Up page link found.'));
$this->assertRaw(l('up', 'node/' . $up->nid, array('html'=> TRUE, 'attributes' => array('title' => t('Go to parent page')))), t('Up page link found.'));
}
if ($next) {
$this->assertRaw(l($next->title . ' <b>›</b>', 'node/' . $next->nid, array('html'=> TRUE, 'attributes' => array('rel' => array('next'), 'title' => t('Go to next page')))), t('Next page link found.'));
$this->assertRaw(l($next->label() . ' <b>›</b>', 'node/' . $next->nid, array('html'=> TRUE, 'attributes' => array('rel' => array('next'), 'title' => t('Go to next page')))), t('Next page link found.'));
}
// Compute the expected breadcrumb.
......@@ -172,7 +172,7 @@ function checkBookNode(Node $node, $nodes, $previous = FALSE, $up = FALSE, $next
// Check printer friendly version.
$this->drupalGet('book/export/html/' . $node->nid);
$this->assertText($node->title, t('Printer friendly title found.'));
$this->assertText($node->label(), t('Printer friendly title found.'));
$this->assertRaw(check_markup($node->body[LANGUAGE_NOT_SPECIFIED][0]['value'], $node->body[LANGUAGE_NOT_SPECIFIED][0]['format']), t('Printer friendly body found.'));
$number++;
......@@ -186,7 +186,7 @@ function checkBookNode(Node $node, $nodes, $previous = FALSE, $up = FALSE, $next
function generateOutlinePattern($nodes) {
$outline = '';
foreach ($nodes as $node) {
$outline .= '(node\/' . $node->nid . ')(.*?)(' . $node->title . ')(.*?)';
$outline .= '(node\/' . $node->nid . ')(.*?)(' . $node->label() . ')(.*?)';
}
return '/<nav id="book-navigation-' . $this->book->nid . '"(.*?)<ul(.*?)' . $outline . '<\/ul>/s';
......@@ -241,7 +241,7 @@ function testBookExport() {
// Make sure each part of the book is there.
foreach ($nodes as $node) {
$this->assertText($node->title, t('Node title found in printer friendly version.'));
$this->assertText($node->label(), t('Node title found in printer friendly version.'));
$this->assertRaw(check_markup($node->body[LANGUAGE_NOT_SPECIFIED][0]['value'], $node->body[LANGUAGE_NOT_SPECIFIED][0]['format']), t('Node body found in printer friendly version.'));
}
......@@ -292,8 +292,8 @@ function testBookNavigationBlock() {
$nodes = $this->createBook();
$this->drupalGet('<front>');
$this->assertText($block_title, t('Book navigation block is displayed.'));
$this->assertText($this->book->title, t('Link to book root (@title) is displayed.', array('@title' => $nodes[0]->title)));
$this->assertNoText($nodes[0]->title, t('No links to individual book pages are displayed.'));
$this->assertText($this->book->label(), t('Link to book root (@title) is displayed.', array('@title' => $nodes[0]->label())));
$this->assertNoText($nodes[0]->label(), t('No links to individual book pages are displayed.'));
}
/**
......
......@@ -36,7 +36,7 @@
*/
function comment_reply(Node $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->label(), 'node/' . $node->nid)));
$op = isset($_POST['op']) ? $_POST['op'] : '';
$build = array();
......
......@@ -195,7 +195,7 @@ function comment_tokens($type, $tokens, array $data = array(), array $options =
case 'node':
$node = node_load($comment->nid);
$title = $node->title;
$title = $node->label();
$replacements[$original] = $sanitize ? filter_xss($title) : $title;
break;
}
......
......@@ -531,7 +531,7 @@ private function verifyForums($node_user, Node $node, $admin, $response = 200) {
// View forum node.
$this->drupalGet('node/' . $node->nid);
$this->assertResponse(200);
$this->assertTitle($node->title . ' | Drupal', t('Forum node was displayed'));
$this->assertTitle($node->label() . ' | Drupal', t('Forum node was displayed'));
$breadcrumb = array(
l(t('Home'), NULL),
l(t('Forums'), 'forum'),
......@@ -544,7 +544,7 @@ private function verifyForums($node_user, Node $node, $admin, $response = 200) {
$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->label() . ' | Drupal', t('Forum edit node was displayed'));
}
if ($response == 200) {
......
......@@ -86,11 +86,11 @@ function testPathLanguageConfiguration() {
// Confirm English language path alias works.
$this->drupalGet($english_path);
$this->assertText($node->title, t('English alias works.'));
$this->assertText($node->label(), 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->label(), t('Custom language alias works.'));
// Create a custom path.
$custom_path = $this->randomName(8);
......@@ -132,18 +132,18 @@ function testPathLanguageConfiguration() {
// Test that both node titles link to our path alias.
$this->drupalGet('<front>');
$custom_path_url = base_path() . $GLOBALS['script_path'] . $custom_path;
$elements = $this->xpath('//a[@href=:href and .=:title]', array(':href' => $custom_path_url, ':title' => $first_node->title));
$elements = $this->xpath('//a[@href=:href and .=:title]', array(':href' => $custom_path_url, ':title' => $first_node->label()));
$this->assertTrue(!empty($elements), t('First node links to the path alias.'));
$elements = $this->xpath('//a[@href=:href and .=:title]', array(':href' => $custom_path_url, ':title' => $second_node->title));
$elements = $this->xpath('//a[@href=:href and .=:title]', array(':href' => $custom_path_url, ':title' => $second_node->label()));
$this->assertTrue(!empty($elements), t('Second node links to the path alias.'));
// Confirm that the custom path leads to the first node.
$this->drupalGet($custom_path);
$this->assertText($first_node->title, t('Custom alias returns first node.'));
$this->assertText($first_node->label(), t('Custom alias returns first node.'));
// Confirm that the custom path with prefix leads to the second node.
$this->drupalGet($prefix . '/' . $custom_path);
$this->assertText($second_node->title, t('Custom alias with prefix returns second node.'));
$this->assertText($second_node->label(), t('Custom alias with prefix returns second node.'));
}
}
......@@ -355,7 +355,7 @@ function verifyMenuLink($item, $item_node, $parent = NULL, $parent_node = NULL)
// Verify menu link link.
$this->clickLink($title);
$title = $parent_node->title;
$title = $parent_node->label();
$this->assertTitle(t("@title | Drupal", array('@title' => $title)), t('Parent menu link link target was correct'));
}
......@@ -365,7 +365,7 @@ function verifyMenuLink($item, $item_node, $parent = NULL, $parent_node = NULL)
// Verify menu link link.
$this->clickLink($title);
$title = $item_node->title;
$title = $item_node->label();
$this->assertTitle(t("@title | Drupal", array('@title' => $title)), t('Menu link link target was correct'));
}
......
......@@ -54,7 +54,7 @@ public function testCommentPager() {
// View the node page. With the default 50 comments per page there should
// be two pages (0, 1) but no third (2) page.
$this->drupalGet('node/' . $node->nid);
$this->assertText($node->title, t('Node title found.'));
$this->assertText($node->label(), t('Node title found.'));
$this->assertText(t('Comments'), t('Has a comments section.'));
$this->assertRaw('page=1', t('Secound page exists.'));
$this->assertNoRaw('page=2', t('No third page exists.'));
......
......@@ -85,12 +85,12 @@ function testRecentNodeBlock() {
// Test that only the 2 latest nodes are shown.
$this->drupalLogin($this->web_user);
$this->assertNoText($node1->title, t('Node not found in block.'));
$this->assertText($node2->title, t('Node found in block.'));
$this->assertText($node3->title, t('Node found in block.'));
$this->assertNoText($node1->label(), t('Node not found in block.'));
$this->assertText($node2->label(), t('Node found in block.'));
$this->assertText($node3->label(), t('Node found in block.'));
// Check to make sure nodes are in the right order.
$this->assertTrue($this->xpath('//div[@id="block-node-recent"]/div/table/tbody/tr[position() = 1]/td/div/a[text() = "' . $node3->title . '"]'), t('Nodes were ordered correctly in block.'));
$this->assertTrue($this->xpath('//div[@id="block-node-recent"]/div/table/tbody/tr[position() = 1]/td/div/a[text() = "' . $node3->label() . '"]'), t('Nodes were ordered correctly in block.'));
// Set the number of recent nodes to show to 10.
$this->drupalLogout();
......@@ -109,10 +109,10 @@ function testRecentNodeBlock() {
// Test that all four nodes are shown.
$this->drupalGet('');
$this->assertText($node1->title, t('Node found in block.'));
$this->assertText($node2->title, t('Node found in block.'));
$this->assertText($node3->title, t('Node found in block.'));
$this->assertText($node4->title, t('Node found in block.'));
$this->assertText($node1->label(), t('Node found in block.'));
$this->assertText($node2->label(), t('Node found in block.'));
$this->assertText($node3->label(), t('Node found in block.'));
$this->assertText($node4->label(), t('Node found in block.'));
// Create the custom block.
$custom_block = array();
......
......@@ -37,15 +37,15 @@ function testNodeMultipleLoad() {
// Confirm that promoted nodes appear in the default node listing.
$this->drupalGet('node');
$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.'));
$this->assertText($node1->label(), t('Node title appears on the default listing.'));
$this->assertText($node2->label(), t('Node title appears on the default listing.'));
$this->assertNoText($node3->label(), t('Node title does not appear in the default listing.'));
$this->assertNoText($node4->label(), 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(FALSE, array('promote' => 0));
$this->assertEqual($node3->title, $nodes[$node3->nid]->title, t('Node was loaded.'));
$this->assertEqual($node4->title, $nodes[$node4->nid]->title, t('Node was loaded.'));
$this->assertEqual($node3->label(), $nodes[$node3->nid]->label(), t('Node was loaded.'));
$this->assertEqual($node4->label(), $nodes[$node4->nid]->label(), t('Node was loaded.'));
$count = count($nodes);
$this->assertTrue($count == 2, t('@count nodes loaded.', array('@count' => $count)));
......@@ -64,9 +64,9 @@ function testNodeMultipleLoad() {
$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, $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->assertEqual($nodes[$node1->nid]->label(), $node1->label(), t('Node successfully loaded.'));
$this->assertEqual($nodes[$node2->nid]->label(), $node2->label(), t('Node successfully loaded.'));
$this->assertEqual($nodes[$node3->nid]->label(), $node3->label(), t('Node successfully loaded.'));
$this->assertFalse(isset($nodes[$node4->nid]));
// Now that all nodes have been loaded into the static cache, ensure that
......@@ -74,15 +74,15 @@ function testNodeMultipleLoad() {
$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, $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->assertEqual($nodes[$node1->nid]->label(), $node1->label(), t('Node successfully loaded'));
$this->assertEqual($nodes[$node2->nid]->label(), $node2->label(), t('Node successfully loaded'));
$this->assertEqual($nodes[$node3->nid]->label(), $node3->label(), 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, $node3->title, t('Node successfully loaded.'));
$this->assertEqual($nodes[$node3->nid]->label(), $node3->label(), t('Node successfully loaded.'));
}
}
......@@ -81,7 +81,7 @@ function testRevisions() {
// 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' => 'Basic page', '%title' => $nodes[1]->title,
array('@type' => 'Basic page', '%title' => $nodes[1]->label(),
'%revision-date' => format_date($nodes[1]->revision_timestamp))), t('Revision reverted.'));
$reverted_node = node_load($node->nid);
$this->assertTrue(($nodes[1]->body[LANGUAGE_NOT_SPECIFIED][0]['value'] == $reverted_node->body[LANGUAGE_NOT_SPECIFIED][0]['value']), t('Node reverted correctly.'));
......@@ -94,7 +94,7 @@ function testRevisions() {
$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' => 'Basic page', '%title' => $nodes[1]->title)), t('Revision deleted.'));
'@type' => 'Basic page', '%title' => $nodes[1]->label())), 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.'));
// Set the revision timestamp to an older date to make sure that the
......@@ -109,7 +109,7 @@ function testRevisions() {
$this->drupalPost("node/$node->nid/revisions/{$nodes[2]->vid}/revert", array(), t('Revert'));
$this->assertRaw(t('@type %title has been reverted back to the revision from %revision-date.', array(
'@type' => 'Basic page',
'%title' => $nodes[2]->title,
'%title' => $nodes[2]->label(),
'%revision-date' => format_date($old_revision_date),
)));
}
......
......@@ -134,7 +134,7 @@ function testDeterminingChanges() {
// Update the node without applying changes.
$node->save();
$this->assertEqual($node->title, 'test_changes', 'No changes have been determined.');
$this->assertEqual($node->label(), 'test_changes', 'No changes have been determined.');
// Apply changes.
$node->title = 'updated';
......@@ -142,10 +142,10 @@ function testDeterminingChanges() {
// The hook implementations node_test_node_presave() and
// node_test_node_update() determine changes and change the title.
$this->assertEqual($node->title, 'updated_presave_update', 'Changes have been determined.');
$this->assertEqual($node->label(), 'updated_presave_update', 'Changes have been determined.');
// Test the static node load cache to be cleared.
$node = node_load($node->nid);
$this->assertEqual($node->title, 'updated_presave', 'Static cache has been cleared.');
$this->assertEqual($node->label(), 'updated_presave', 'Static cache has been cleared.');
}
}
......@@ -42,18 +42,18 @@ function testNodeTitle() {
// Test <title> tag.
$this->drupalGet("node/$node->nid");
$xpath = '//title';
$this->assertEqual(current($this->xpath($xpath)), $node->title .' | Drupal', 'Page title is equal to node title.', 'Node');
$this->assertEqual(current($this->xpath($xpath)), $node->label() .' | Drupal', 'Page title is equal to node title.', 'Node');
// Test breadcrumb in comment preview.
$this->drupalGet("comment/reply/$node->nid");
$xpath = '//nav[@class="breadcrumb"]/ol/li[last()]/a';
$this->assertEqual(current($this->xpath($xpath)), $node->title, 'Node breadcrumb is equal to node title.', 'Node');
$this->assertEqual(current($this->xpath($xpath)), $node->label(), 'Node breadcrumb is equal to node title.', 'Node');
// Test node title in comment preview.
$this->assertEqual(current($this->xpath('//article[@id=:id]/h2/a', array(':id' => 'node-' . $node->nid))), $node->title, 'Node preview title is equal to node title.', 'Node');
$this->assertEqual(current($this->xpath('//article[@id=:id]/h2/a', array(':id' => 'node-' . $node->nid))), $node->label(), 'Node preview title is equal to node title.', 'Node');
// Test node title is clickable on teaser list (/node).
$this->drupalGet('node');
$this->clickLink($node->title);
$this->clickLink($node->label());
}
}
......@@ -341,7 +341,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->label(), 'node/' . $node->nid);
// Update our progress information.
$context['sandbox']['progress']++;
......@@ -485,7 +485,7 @@ function node_admin_nodes() {
'title' => array(
'data' => array(
'#type' => 'link',
'#title' => $node->title,
'#title' => $node->label(),
'#href' => 'node/' . $node->nid,
'#options' => $l_options,
'#suffix' => ' ' . theme('mark', array('type' => node_mark($node->nid, $node->changed))),
......
......@@ -485,7 +485,7 @@ function hook_node_predelete(Drupal\node\Node $node) {
* @ingroup node_api_hooks
*/
function hook_node_delete(Drupal\node\Node $node) {
drupal_set_message(t('Node: @title has been deleted', array('@title' => $node->title)));
drupal_set_message(t('Node: @title has been deleted', array('@title' => $node->label())));
}
/**
......
......@@ -323,6 +323,7 @@ function node_title_list($result, $title = NULL) {
$items = array();
$num_rows = FALSE;
foreach ($result as $node) {
// Do not use $node->label() here, because $node comes from the database.
$items[] = l($node->title, 'node/' . $node->nid, !empty($node->comment_count) ? array('attributes' => array('title' => format_plural($node->comment_count, '1 comment', '@count comments'))) : array());
$num_rows = TRUE;
}
......@@ -1268,7 +1269,7 @@ function node_build_content(Node $node, $view_mode = 'full', $langcode = NULL) {
'#attributes' => array('class' => array('links', 'inline')),
);
if ($view_mode == 'teaser') {
$node_title_stripped = strip_tags($node->title);
$node_title_stripped = strip_tags($node->label());
$links['node-readmore'] = array(
'title' => t('Read more<span class="element-invisible"> about @title</span>', array('@title' => $node_title_stripped)),
'href' => 'node/' . $node->nid,
......@@ -1303,7 +1304,7 @@ function node_build_content(Node $node, $view_mode = 'full', $langcode = NULL) {
*/
function node_show(Node $node, $message = FALSE) {
if ($message) {
drupal_set_title(t('Revision of %title from %date', array('%title' => $node->title, '%date' => format_date($node->revision_timestamp))), PASS_THROUGH);
drupal_set_title(t('Revision of %title from %date', array('%title' => $node->label(), '%date' => format_date($node->revision_timestamp))), PASS_THROUGH);
}
// For markup consistency with other pages, use node_view_multiple() rather than node_view().
......@@ -1611,7 +1612,7 @@ function node_search_execute($keys = NULL, $conditions = NULL) {
$results[] = array(
'link' => url($uri['path'], array_merge($uri['options'], array('absolute' => TRUE))),
'type' => check_plain(node_type_get_name($node)),
'title' => $node->title,
'title' => $node->label(),
'user' => theme('username', array('account' => $node)),
'date' => $node->changed,
'node' => $node,
......@@ -2065,7 +2066,7 @@ function node_type_page_title($type) {
* @see node_menu()
*/
function node_page_title(Node $node) {
return $node->title;
return $node->label();
}
/**
......@@ -2264,7 +2265,7 @@ function theme_node_recent_content($variables) {
$node = $variables['node'];
$output = '<div class="node-title">';
$output .= l($node->title, 'node/' . $node->nid);
$output .= l($node->label(), 'node/' . $node->nid);
$output .= theme('mark', array('type' => node_mark($node->nid, $node->changed)));
$output .= '</div><div class="node-author">';
$output .= theme('username', array('account' => user_load($node->uid)));
......@@ -2487,7 +2488,7 @@ function node_feed($nids = FALSE, $channel = array()) {
$item_text .= drupal_render($build);
}
$items .= format_rss_item($node->title, $node->link, $item_text, $node->rss_elements);
$items .= format_rss_item($node->label(), $node->link, $item_text, $node->rss_elements);
}
$channel_defaults = array(
......@@ -2602,7 +2603,7 @@ function node_page_view(Node $node) {
// If there is a menu link to this node, the link becomes the last part
// of the active trail, and the link name becomes the page title.
// Thus, we must explicitly set the page title to be the node title.
drupal_set_title($node->title);
drupal_set_title($node->label());
$uri = entity_uri('node', $node);
// Set the node path as the canonical URL to prevent duplicate content.
drupal_add_html_head_link(array('rel' => 'canonical', 'href' => url($uri['path'], $uri['options'])), TRUE);
......@@ -2645,7 +2646,7 @@ function _node_index_node(Node $node) {
unset($build['#theme']);
$node->rendered = drupal_render($build);
$text = '<h1>' . check_plain($node->title) . '</h1>' . $node->rendered;
$text = '<h1>' . check_plain($node->label()) . '</h1>' . $node->rendered;
// Fetch extra data normally not visible
$extra = module_invoke_all('node_update_index', $node);
......@@ -3747,7 +3748,7 @@ function node_action_info() {
*/
function node_publish_action(Node $node, $context = array()) {
$node->status = NODE_PUBLISHED;
watchdog('action', 'Set @type %title to published.', array('@type' => node_type_get_name($node), '%title' => $node->title));
watchdog('action', 'Set @type %title to published.', array('@type' => node_type_get_name($node), '%title' => $node->label()));
}
/**
......@@ -3763,7 +3764,7 @@ function node_publish_action(Node $node, $context = array()) {
*/
function node_unpublish_action(Node $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));
watchdog('action', 'Set @type %title to unpublished.', array('@type' => node_type_get_name($node), '%title' => $node->label()));
}
/**
......@@ -3779,7 +3780,7 @@ function node_unpublish_action(Node $node, $context = array()) {
*/
function node_make_sticky_action(Node $node, $context = array()) {
$node->sticky = NODE_STICKY;
watchdog('action', 'Set @type %title to sticky.', array('@type' => node_type_get_name($node), '%title' => $node->title));
watchdog('action', 'Set @type %title to sticky.', array('@type' => node_type_get_name($node), '%title' => $node->label()));
}
/**
......@@ -3795,7 +3796,7 @@ function node_make_sticky_action(Node $node, $context = array()) {
*/
function node_make_unsticky_action(Node $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));
watchdog('action', 'Set @type %title to unsticky.', array('@type' => node_type_get_name($node), '%title' => $node->label()));
}
/**
......@@ -3811,7 +3812,7 @@ function node_make_unsticky_action(Node $node, $context = array()) {
*/
function node_promote_action(Node $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));
watchdog('action', 'Promoted @type %title to front page.', array('@type' => node_type_get_name($node), '%title' => $node->label()));
}
/**
......@@ -3827,7 +3828,7 @@ function node_promote_action(Node $node, $context = array()) {
*/
function node_unpromote_action(Node $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));
watchdog('action', 'Removed @type %title from front page.', array('@type' => node_type_get_name($node), '%title' => $node->label()));
}
/**
......@@ -3840,7 +3841,7 @@ function node_unpromote_action(Node $node, $context = array()) {
*/
function node_save_action(Node $node) {
$node->save();
watchdog('action', 'Saved @type %title', array('@type' => node_type_get_name($node), '%title' => $node->title));
watchdog('action', 'Saved @type %title', array('@type' => node_type_get_name($node), '%title' => $node->label()));
}
/**
......@@ -3861,7 +3862,7 @@ function node_save_action(Node $node) {
function node_assign_owner_action(Node $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_name($node), '%title' => $node->title, '%name' => $owner_name));
watchdog('action', 'Changed owner of @type %title to uid %name.', array('@type' => node_type_get_name($node), '%title' => $node->label(), '%name' => $owner_name));
}
/**
......@@ -3975,9 +3976,9 @@ function node_unpublish_by_keyword_action_submit($form, $form_state) {
function node_unpublish_by_keyword_action(Node $node, $context) {
foreach ($context['keywords'] as $keyword) {
$elements = node_view(clone $node);
if (strpos(drupal_render($elements), $keyword) !== FALSE || strpos($node->title, $keyword) !== FALSE) {
if (strpos(drupal_render($elements), $keyword) !== FALSE || strpos($node->label(), $keyword) !== FALSE) {
$node->status = NODE_NOT_PUBLISHED;
watchdog('action', 'Set @type %title to unpublished.', array('@type' => node_type_get_name($node), '%title' => $node->title));
watchdog('action', 'Set @type %title to unpublished.', array('@type' => node_type_get_name($node), '%title' => $node->label()));
break;
}
}
......