diff --git a/core/includes/form.inc b/core/includes/form.inc index 8059ea1093c83f8317c4a33a0cd105d042678ebb..eee8be1a1bf7ee0b16c233df7414ba2ca1b1bef3 100644 --- a/core/includes/form.inc +++ b/core/includes/form.inc @@ -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']; diff --git a/core/modules/book/book.admin.inc b/core/modules/book/book.admin.inc index 80a07700649f684432f923b63359d13b273443b0..7d007c44a9596fd1de2598763d94e18e292d9ee9 100644 --- a/core/modules/book/book.admin.inc +++ b/core/modules/book/book.admin.inc @@ -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()))); } /** diff --git a/core/modules/book/book.module b/core/modules/book/book.module index 1087e23af6e5765d3dfcdc877ac5088c22d5f4ac..987d281fb6fd8ffcf0fbf25a1dc2419e5c47526f 100644 --- a/core/modules/book/book.module +++ b/core/modules/book/book.module @@ -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; } diff --git a/core/modules/book/book.pages.inc b/core/modules/book/book.pages.inc index 3ca79bd27879bc728337a5dacae862a45a93a3e3..90b219235f4e6bb33dce4359c470639da6270662 100644 --- a/core/modules/book/book.pages.inc +++ b/core/modules/book/book.pages.inc @@ -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); diff --git a/core/modules/book/lib/Drupal/book/Tests/BookTest.php b/core/modules/book/lib/Drupal/book/Tests/BookTest.php index 9e621bb723937f1821de11e921105aa1a4f6bd80..a5c314671c8ddc058b7d3416700909cd32e6a643 100644 --- a/core/modules/book/lib/Drupal/book/Tests/BookTest.php +++ b/core/modules/book/lib/Drupal/book/Tests/BookTest.php @@ -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.')); } /** diff --git a/core/modules/comment/comment.pages.inc b/core/modules/comment/comment.pages.inc index 517684653103342c01c183375b209d6262278f54..3167bd74882d0ef73f8becf4f4822414fb07bd0a 100644 --- a/core/modules/comment/comment.pages.inc +++ b/core/modules/comment/comment.pages.inc @@ -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(); diff --git a/core/modules/comment/comment.tokens.inc b/core/modules/comment/comment.tokens.inc index 1c6a7eeacb27ef06f928f573b0dcc61ea40b1ebc..f4a401dcea68f938780ada800245f95c59a7bbc8 100644 --- a/core/modules/comment/comment.tokens.inc +++ b/core/modules/comment/comment.tokens.inc @@ -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; } diff --git a/core/modules/forum/lib/Drupal/forum/Tests/ForumTest.php b/core/modules/forum/lib/Drupal/forum/Tests/ForumTest.php index 14a4c7be9986b74ecab61d9dee5065f9913c0f39..6453e1ae3f2d8613d9701b03b775b5006c9de47a 100644 --- a/core/modules/forum/lib/Drupal/forum/Tests/ForumTest.php +++ b/core/modules/forum/lib/Drupal/forum/Tests/ForumTest.php @@ -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) { diff --git a/core/modules/locale/lib/Drupal/locale/Tests/LocalePathTest.php b/core/modules/locale/lib/Drupal/locale/Tests/LocalePathTest.php index 5476a7a7957a9139c83189a47c1a80f5eb365e0d..61c45721dae479f43a33cbadf41fcd00d304b40c 100644 --- a/core/modules/locale/lib/Drupal/locale/Tests/LocalePathTest.php +++ b/core/modules/locale/lib/Drupal/locale/Tests/LocalePathTest.php @@ -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.')); } } diff --git a/core/modules/menu/lib/Drupal/menu/Tests/MenuTest.php b/core/modules/menu/lib/Drupal/menu/Tests/MenuTest.php index 4cdf809dfd01f22a9a1ac0b75690e0c9bca792c8..b34092e7ee3877343da5e9d2380445b24b233b17 100644 --- a/core/modules/menu/lib/Drupal/menu/Tests/MenuTest.php +++ b/core/modules/menu/lib/Drupal/menu/Tests/MenuTest.php @@ -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')); } diff --git a/core/modules/node/lib/Drupal/node/Tests/NodeAccessPagerTest.php b/core/modules/node/lib/Drupal/node/Tests/NodeAccessPagerTest.php index 1d2c58855d5b233bd96a2c1840831fe5ff2cc112..2506965c33da51937d9a4b038633ef62bf63da59 100644 --- a/core/modules/node/lib/Drupal/node/Tests/NodeAccessPagerTest.php +++ b/core/modules/node/lib/Drupal/node/Tests/NodeAccessPagerTest.php @@ -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.')); diff --git a/core/modules/node/lib/Drupal/node/Tests/NodeBlockFunctionalTest.php b/core/modules/node/lib/Drupal/node/Tests/NodeBlockFunctionalTest.php index abfcbdd466490fbd030563ac82d3c1dd2aaf3b27..6ff9b7229f9d3da6cdf18f58666591f57b7cfc4a 100644 --- a/core/modules/node/lib/Drupal/node/Tests/NodeBlockFunctionalTest.php +++ b/core/modules/node/lib/Drupal/node/Tests/NodeBlockFunctionalTest.php @@ -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(); diff --git a/core/modules/node/lib/Drupal/node/Tests/NodeLoadMultipleTest.php b/core/modules/node/lib/Drupal/node/Tests/NodeLoadMultipleTest.php index d08553ca66a8ecc32c764cfe90b20e415b900573..dd7f9da176e78ad9174820f7988ec4d26f38c0a2 100644 --- a/core/modules/node/lib/Drupal/node/Tests/NodeLoadMultipleTest.php +++ b/core/modules/node/lib/Drupal/node/Tests/NodeLoadMultipleTest.php @@ -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.')); } } diff --git a/core/modules/node/lib/Drupal/node/Tests/NodeRevisionsTest.php b/core/modules/node/lib/Drupal/node/Tests/NodeRevisionsTest.php index 3cba15d075d282586a9fd6274616267d77b46ab5..ee12f0ac2285dca1679b6ae18acf41dfc49bd78e 100644 --- a/core/modules/node/lib/Drupal/node/Tests/NodeRevisionsTest.php +++ b/core/modules/node/lib/Drupal/node/Tests/NodeRevisionsTest.php @@ -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), ))); } diff --git a/core/modules/node/lib/Drupal/node/Tests/NodeSaveTest.php b/core/modules/node/lib/Drupal/node/Tests/NodeSaveTest.php index 3bf6a19bf54e4d44eced27f1ddd8e89300d2c807..9dcebf9ae852b801bb041a55c82a83debc61cd8c 100644 --- a/core/modules/node/lib/Drupal/node/Tests/NodeSaveTest.php +++ b/core/modules/node/lib/Drupal/node/Tests/NodeSaveTest.php @@ -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.'); } } diff --git a/core/modules/node/lib/Drupal/node/Tests/NodeTitleTest.php b/core/modules/node/lib/Drupal/node/Tests/NodeTitleTest.php index a195731df40e5c303c0d6bb64b21e366a60b4cf4..5ebe6cfe850c46c2af4cac7a0f37e0af072a2b97 100644 --- a/core/modules/node/lib/Drupal/node/Tests/NodeTitleTest.php +++ b/core/modules/node/lib/Drupal/node/Tests/NodeTitleTest.php @@ -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()); } } diff --git a/core/modules/node/node.admin.inc b/core/modules/node/node.admin.inc index 1bb45474b007ec8bc90a0225a80ee96605e4c6f2..d4252324a4ac6b4444da77813e2c8f663d11f984 100644 --- a/core/modules/node/node.admin.inc +++ b/core/modules/node/node.admin.inc @@ -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))), diff --git a/core/modules/node/node.api.php b/core/modules/node/node.api.php index 9719fc0340113a4d8f688f5b1810f44be37fb92a..f4fb5f512f23173a5c8052ec0ab8e39bede746cb 100644 --- a/core/modules/node/node.api.php +++ b/core/modules/node/node.api.php @@ -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()))); } /** diff --git a/core/modules/node/node.module b/core/modules/node/node.module index 3db5bbd1e8afcf57c86624b1f75f5f8889ab9544..bb0078003c2a9450bd1ac15072bcee2a1ac03f4c 100644 --- a/core/modules/node/node.module +++ b/core/modules/node/node.module @@ -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; } } diff --git a/core/modules/node/node.pages.inc b/core/modules/node/node.pages.inc index 5d60f7c7af591b7473e654ba1bb43cface39fed9..16b0ee54dd6b0f4b25112a4b9b6bd6a523d761b0 100644 --- a/core/modules/node/node.pages.inc +++ b/core/modules/node/node.pages.inc @@ -18,7 +18,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->label())), PASS_THROUGH); return drupal_get_form($node->type . '_node_form', $node); } @@ -501,8 +501,8 @@ function node_form_submit($form, &$form_state) { $insert = empty($node->nid); $node->save(); $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->label()); + $t_args = array('@type' => node_type_get_name($node), '%title' => $node->label()); if ($insert) { watchdog('content', '@type: added %title.', $watchdog_args, WATCHDOG_NOTICE, $node_link); @@ -598,7 +598,7 @@ function node_delete_confirm($form, &$form_state, $node) { // Always provide entity id in the same form key as in the entity edit form. $form['nid'] = array('#type' => 'value', '#value' => $node->nid); 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->label())), 'node/' . $node->nid, t('This action cannot be undone.'), t('Delete'), @@ -613,8 +613,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->label())); + drupal_set_message(t('@type %title has been deleted.', array('@type' => node_type_get_name($node), '%title' => $node->label()))); } $form_state['redirect'] = '<front>'; @@ -626,7 +626,7 @@ function node_delete_confirm_submit($form, &$form_state) { * @see node_menu() */ 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->label())), PASS_THROUGH); $header = array(t('Revision'), array('data' => t('Operations'), 'colspan' => 2)); @@ -704,8 +704,8 @@ function node_revision_revert_confirm_submit($form, &$form_state) { $node_revision->save(); - 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($original_revision_timestamp)))); + watchdog('content', '@type: reverted %title revision %revision.', array('@type' => $node_revision->type, '%title' => $node_revision->label(), '%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->label(), '%revision-date' => format_date($original_revision_timestamp)))); $form_state['redirect'] = 'node/' . $node_revision->nid . '/revisions'; } @@ -729,8 +729,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->label(), '%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->label()))); $form_state['redirect'] = 'node/' . $node_revision->nid; if (db_query('SELECT COUNT(vid) FROM {node_revision} WHERE nid = :nid', array(':nid' => $node_revision->nid))->fetchField() > 1) { $form_state['redirect'] .= '/revisions'; diff --git a/core/modules/path/lib/Drupal/path/Tests/PathAliasTest.php b/core/modules/path/lib/Drupal/path/Tests/PathAliasTest.php index af8b0c7d0011b25e8087b6933595ac51344bc6b6..e0d7e7c6821fb145d582d3dbed134fcfea2ff6d7 100644 --- a/core/modules/path/lib/Drupal/path/Tests/PathAliasTest.php +++ b/core/modules/path/lib/Drupal/path/Tests/PathAliasTest.php @@ -67,7 +67,7 @@ function testAdminAlias() { // Confirm that the alias works. $this->drupalGet($edit['alias']); - $this->assertText($node1->title, 'Alias works.'); + $this->assertText($node1->label(), 'Alias works.'); $this->assertResponse(200); // Change alias to one containing "exotic" characters. @@ -81,13 +81,13 @@ function testAdminAlias() { // Confirm that the alias works. $this->drupalGet($edit['alias']); - $this->assertText($node1->title, 'Changed alias works.'); + $this->assertText($node1->label(), 'Changed alias works.'); $this->assertResponse(200); drupal_static_reset('drupal_lookup_path'); // Confirm that previous alias no longer works. $this->drupalGet($previous); - $this->assertNoText($node1->title, 'Previous alias no longer works.'); + $this->assertNoText($node1->label(), 'Previous alias no longer works.'); $this->assertResponse(404); // Create second test node. @@ -107,7 +107,7 @@ function testAdminAlias() { // Confirm that the alias no longer works. $this->drupalGet($edit['alias']); - $this->assertNoText($node1->title, 'Alias was successfully deleted.'); + $this->assertNoText($node1->label(), 'Alias was successfully deleted.'); $this->assertResponse(404); // Create a really long alias. @@ -137,7 +137,7 @@ function testNodeAlias() { // Confirm that the alias works. $this->drupalGet($edit['path[alias]']); - $this->assertText($node1->title, 'Alias works.'); + $this->assertText($node1->label(), 'Alias works.'); $this->assertResponse(200); // Change alias to one containing "exotic" characters. @@ -149,12 +149,12 @@ function testNodeAlias() { // Confirm that the alias works. $this->drupalGet($edit['path[alias]']); - $this->assertText($node1->title, 'Changed alias works.'); + $this->assertText($node1->label(), 'Changed alias works.'); $this->assertResponse(200); // Make sure that previous alias no longer works. $this->drupalGet($previous); - $this->assertNoText($node1->title, 'Previous alias no longer works.'); + $this->assertNoText($node1->label(), 'Previous alias no longer works.'); $this->assertResponse(404); // Create second test node. @@ -172,7 +172,7 @@ function testNodeAlias() { // Confirm that the alias no longer works. $this->drupalGet($edit['path[alias]']); - $this->assertNoText($node1->title, 'Alias was successfully deleted.'); + $this->assertNoText($node1->label(), 'Alias was successfully deleted.'); $this->assertResponse(404); } diff --git a/core/modules/path/lib/Drupal/path/Tests/PathLanguageTest.php b/core/modules/path/lib/Drupal/path/Tests/PathLanguageTest.php index b3dba0e0f0df5cd5f7ce420dcf0c06e91aad6072..d550575891121beca614c8d8d0a3c73a3f65d187 100644 --- a/core/modules/path/lib/Drupal/path/Tests/PathLanguageTest.php +++ b/core/modules/path/lib/Drupal/path/Tests/PathLanguageTest.php @@ -56,7 +56,7 @@ function testAliasTranslation() { // Confirm that the alias works. $this->drupalGet($english_alias); - $this->assertText($english_node->title, 'Alias works.'); + $this->assertText($english_node->label(), 'Alias works.'); // Translate the node into French. $this->drupalGet('node/' . $english_node->nid . '/translate'); @@ -78,7 +78,7 @@ function testAliasTranslation() { // Confirm that the alias works. $this->drupalGet('fr/' . $edit['path[alias]']); - $this->assertText($french_node->title, 'Alias for French translation works.'); + $this->assertText($french_node->label(), 'Alias for French translation works.'); // Confirm that the alias is returned by url(). Languages are cached on // many levels, and we need to clear those caches. @@ -112,11 +112,11 @@ function testAliasTranslation() { // path alias for French matching the english alias. So drupal_lookup_path() // needs to use the URL language to check whether the alias is valid. $this->drupalGet($english_alias); - $this->assertText($english_node->title, 'Alias for English translation works.'); + $this->assertText($english_node->label(), 'Alias for English translation works.'); // Check that the French alias works. $this->drupalGet("fr/$french_alias"); - $this->assertText($french_node->title, 'Alias for French translation works.'); + $this->assertText($french_node->label(), 'Alias for French translation works.'); // Disable URL language negotiation. $edit = array('language_interface[enabled][language-url]' => FALSE); @@ -124,7 +124,7 @@ function testAliasTranslation() { // Check that the English alias still works. $this->drupalGet($english_alias); - $this->assertText($english_node->title, 'Alias for English translation works.'); + $this->assertText($english_node->label(), 'Alias for English translation works.'); // Check that the French alias is not available. We check the unprefixed // alias because we disabled URL language negotiation above. In this diff --git a/core/modules/php/lib/Drupal/php/Tests/PhpFilterTest.php b/core/modules/php/lib/Drupal/php/Tests/PhpFilterTest.php index 71ee5beee587f942ef1999c08bac3e4c53fd1a42..81879e8daf6289c7f01ba2a9e053e912388043e3 100644 --- a/core/modules/php/lib/Drupal/php/Tests/PhpFilterTest.php +++ b/core/modules/php/lib/Drupal/php/Tests/PhpFilterTest.php @@ -40,7 +40,7 @@ function testPhpFilter() { $langcode = LANGUAGE_NOT_SPECIFIED; $edit["body[$langcode][0][format]"] = $this->php_code_format->format; $this->drupalPost('node/' . $node->nid . '/edit', $edit, t('Save')); - $this->assertRaw(t('Basic page %title has been updated.', array('%title' => $node->title)), t('PHP code filter turned on.')); + $this->assertRaw(t('Basic page %title has been updated.', array('%title' => $node->label())), t('PHP code filter turned on.')); // Make sure that the PHP code shows up as text. $this->assertNoText('print "SimpleTest PHP was executed!"', t("PHP code isn't displayed.")); diff --git a/core/modules/poll/poll.module b/core/modules/poll/poll.module index 7954aaa393944b009eb7e668f2f4258f766e98fe..db43e19c11540e2023cc79511df3f708c3babd05 100644 --- a/core/modules/poll/poll.module +++ b/core/modules/poll/poll.module @@ -434,7 +434,7 @@ function poll_node_form_submit(&$form, &$form_state) { * Implements hook_validate(). */ function poll_validate($node, $form) { - if (isset($node->title)) { + if ($node->label()) { // Check for at least two options and validate amount of votes. $realchoices = 0; foreach ($node->choice as $i => $choice) { @@ -834,7 +834,7 @@ function poll_view_results($node, $view_mode, $block = FALSE) { ); } - return theme('poll_results', array('raw_title' => $node->title, 'results' => drupal_render($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->label(), 'results' => drupal_render($poll_results), 'votes' => $total_votes, 'raw_links' => isset($node->links) ? $node->links : array(), 'block' => $block, 'nid' => $node->nid, 'vote' => isset($node->vote) ? $node->vote : NULL)); } diff --git a/core/modules/poll/poll.pages.inc b/core/modules/poll/poll.pages.inc index 732355de3e7ff075c5296c1893e1d68f963b9cb8..e33dc1fb35ad49926e24c3f9f4bf8cd86630c69c 100644 --- a/core/modules/poll/poll.pages.inc +++ b/core/modules/poll/poll.pages.inc @@ -37,6 +37,7 @@ function poll_page() { ->fetchAllAssoc('nid'); $output = '<ul>'; + // Do not use $node->label() here because $node comes from the database. foreach ($queried_nodes as $node) { $output .= '<li>' . l($node->title, "node/$node->nid") . ' - ' . format_plural($node->votes, '1 vote', '@count votes') . ' - ' . ($node->active ? t('open') : t('closed')) . '</li>'; } @@ -50,7 +51,7 @@ function poll_page() { */ function poll_votes($node) { $votes_per_page = 20; - drupal_set_title($node->title); + drupal_set_title($node->label()); $header[] = array('data' => t('Visitor'), 'field' => 'u.name'); $header[] = array('data' => t('Vote'), 'field' => 'pc.chtext'); @@ -93,7 +94,7 @@ function poll_votes($node) { * Callback for the 'results' tab for polls you can vote on */ function poll_results($node) { - drupal_set_title($node->title); + drupal_set_title($node->label()); $node->show_results = TRUE; return node_show($node); } diff --git a/core/modules/search/lib/Drupal/search/Tests/SearchAdvancedSearchFormTest.php b/core/modules/search/lib/Drupal/search/Tests/SearchAdvancedSearchFormTest.php index 633238da7eb0f56f49055ca04741c82c9111e137..db559811b4503a5b2adbbaa1e806eaf55b714706 100644 --- a/core/modules/search/lib/Drupal/search/Tests/SearchAdvancedSearchFormTest.php +++ b/core/modules/search/lib/Drupal/search/Tests/SearchAdvancedSearchFormTest.php @@ -46,24 +46,24 @@ function testNodeType() { // Assert that the dummy title doesn't equal the real title. $dummy_title = 'Lorem ipsum'; - $this->assertNotEqual($dummy_title, $this->node->title, t("Dummy title doesn't equal node title")); + $this->assertNotEqual($dummy_title, $this->node->label(), t("Dummy title doesn't equal node title")); // Search for the dummy title with a GET query. $this->drupalGet('search/node/' . $dummy_title); - $this->assertNoText($this->node->title, t('Basic page node is not found with dummy title.')); + $this->assertNoText($this->node->label(), t('Basic page node is not found with dummy title.')); // Search for the title of the node with a GET query. - $this->drupalGet('search/node/' . $this->node->title); - $this->assertText($this->node->title, t('Basic page node is found with GET query.')); + $this->drupalGet('search/node/' . $this->node->label()); + $this->assertText($this->node->label(), t('Basic page node is found with GET query.')); // Search for the title of the node with a POST query. - $edit = array('or' => $this->node->title); + $edit = array('or' => $this->node->label()); $this->drupalPost('search/node', $edit, t('Advanced search')); - $this->assertText($this->node->title, t('Basic page node is found with POST query.')); + $this->assertText($this->node->label(), t('Basic page node is found with POST query.')); // Advanced search type option. $this->drupalPost('search/node', array_merge($edit, array('type[page]' => 'page')), t('Advanced search')); - $this->assertText($this->node->title, t('Basic page node is found with POST query and type:page.')); + $this->assertText($this->node->label(), t('Basic page node is found with POST query and type:page.')); $this->drupalPost('search/node', array_merge($edit, array('type[article]' => 'article')), t('Advanced search')); $this->assertText('bike shed', t('Article node is not found with POST query and type:article.')); diff --git a/core/modules/search/lib/Drupal/search/Tests/SearchCommentTest.php b/core/modules/search/lib/Drupal/search/Tests/SearchCommentTest.php index 20498afef91a4f351eb0fbd016ec0dfbc342d1cd..16e74e57dcb372505ce0de62183c522659a488b5 100644 --- a/core/modules/search/lib/Drupal/search/Tests/SearchCommentTest.php +++ b/core/modules/search/lib/Drupal/search/Tests/SearchCommentTest.php @@ -81,7 +81,8 @@ function testSearchResultsComment() { 'search_block_form' => "'" . $edit_comment['subject'] . "'", ); $this->drupalPost('', $edit, t('Search')); - $this->assertText($node->title, t('Node found in search results.')); + $node2 = node_load($node->nid, NULL, TRUE); + $this->assertText($node2->label(), t('Node found in search results.')); $this->assertText($edit_comment['subject'], t('Comment subject found in search results.')); // Search for the comment body. @@ -89,7 +90,7 @@ function testSearchResultsComment() { 'search_block_form' => "'" . $comment_body . "'", ); $this->drupalPost('', $edit, t('Search')); - $this->assertText($node->title, t('Node found in search results.')); + $this->assertText($node2->label(), t('Node found in search results.')); // Verify that comment is rendered using proper format. $this->assertText($comment_body, t('Comment body text found in search results.')); @@ -194,11 +195,11 @@ function assertCommentAccess($assume_access, $message) { $this->drupalPost('', $edit, t('Search')); if ($assume_access) { - $expected_node_result = $this->assertText($this->node->title); + $expected_node_result = $this->assertText($this->node->label()); $expected_comment_result = $this->assertText($this->comment_subject); } else { - $expected_node_result = $this->assertNoText($this->node->title); + $expected_node_result = $this->assertNoText($this->node->label()); $expected_comment_result = $this->assertNoText($this->comment_subject); } $this->assertTrue($expected_node_result && $expected_comment_result, $message); @@ -236,7 +237,7 @@ function testAddNewComment() { // Search for the node title. Should be found, and 'Add new comment' should // not be part of the search snippet. $this->drupalPost('search/node', array('keys' => 'short'), t('Search')); - $this->assertText($node->title, t('Search for keyword worked')); + $this->assertText($node->label(), t('Search for keyword worked')); $this->assertNoText(t('Add new comment'), t('Add new comment does not appear on search results page')); } } diff --git a/core/modules/search/lib/Drupal/search/Tests/SearchConfigSettingsFormTest.php b/core/modules/search/lib/Drupal/search/Tests/SearchConfigSettingsFormTest.php index fe9ef10bb5008a37817466e3eb3476d5941756cb..aa14cc2894d9c5d66c95005709b06e18aada0921 100644 --- a/core/modules/search/lib/Drupal/search/Tests/SearchConfigSettingsFormTest.php +++ b/core/modules/search/lib/Drupal/search/Tests/SearchConfigSettingsFormTest.php @@ -36,7 +36,7 @@ function setUp() { // also needs the word "pizza" so we can use it as the search keyword. $langcode = LANGUAGE_NOT_SPECIFIED; $body_key = "body[$langcode][0][value]"; - $edit[$body_key] = l($node->title, 'node/' . $node->nid) . ' pizza sandwich'; + $edit[$body_key] = l($node->label(), 'node/' . $node->nid) . ' pizza sandwich'; $this->drupalPost('node/' . $node->nid . '/edit', $edit, t('Save')); node_update_index(); @@ -89,7 +89,7 @@ function testSearchModuleDisabling() { 'path' => 'node', 'title' => 'Content', 'keys' => 'pizza', - 'text' => $this->search_node->title, + 'text' => $this->search_node->label(), ), 'user' => array( 'path' => 'user', diff --git a/core/modules/search/lib/Drupal/search/Tests/SearchEmbedFormTest.php b/core/modules/search/lib/Drupal/search/Tests/SearchEmbedFormTest.php index 9e7f134c342eb8c9d087b173d07e48ccab5babdd..83c75019cce51e13cae9a11d6fb572589b5a4f50 100644 --- a/core/modules/search/lib/Drupal/search/Tests/SearchEmbedFormTest.php +++ b/core/modules/search/lib/Drupal/search/Tests/SearchEmbedFormTest.php @@ -61,9 +61,9 @@ function testEmbeddedForm() { $this->submit_count = $count; // Now verify that we can see and submit the form from the search results. - $this->drupalGet('search/node/' . $this->node->title); + $this->drupalGet('search/node/' . $this->node->label()); $this->assertText(t('Your name'), 'Form is visible'); - $this->drupalPost('search/node/' . $this->node->title, + $this->drupalPost('search/node/' . $this->node->label(), array('name' => 'John'), t('Send away')); $this->assertText(t('Test form was submitted'), 'Form message appears'); diff --git a/core/modules/search/lib/Drupal/search/Tests/SearchNodeAccessTest.php b/core/modules/search/lib/Drupal/search/Tests/SearchNodeAccessTest.php index 618ed5ee6d3672adab871d570e2ff4792d41eb29..955c358eafdbb866c27d50527b61ae551d59ff3f 100644 --- a/core/modules/search/lib/Drupal/search/Tests/SearchNodeAccessTest.php +++ b/core/modules/search/lib/Drupal/search/Tests/SearchNodeAccessTest.php @@ -46,6 +46,6 @@ function testPhraseSearchPunctuation() { // Submit a phrase wrapped in double quotes to include the punctuation. $edit = array('keys' => '"bunny\'s"'); $this->drupalPost('search/node', $edit, t('Search')); - $this->assertText($node->title); + $this->assertText($node->label()); } } diff --git a/core/modules/search/lib/Drupal/search/Tests/SearchNumberMatchingTest.php b/core/modules/search/lib/Drupal/search/Tests/SearchNumberMatchingTest.php index 89756c44a753ae2dfab3fd9d9a9ec27fdf27cba7..39cf6500f3b8a01d4544f95110f0c309d862baf2 100644 --- a/core/modules/search/lib/Drupal/search/Tests/SearchNumberMatchingTest.php +++ b/core/modules/search/lib/Drupal/search/Tests/SearchNumberMatchingTest.php @@ -70,7 +70,7 @@ function testNumberSearching() { $this->drupalPost('search/node', array('keys' => 'foo'), t('Search')); - $this->assertNoText($node->title, $i . ': node title not shown in dummy search'); + $this->assertNoText($node->label(), $i . ': node title not shown in dummy search'); // Now verify that we can find node i by searching for any of the // numbers. @@ -83,7 +83,7 @@ function testNumberSearching() { $this->drupalPost('search/node', array('keys' => $number), t('Search')); - $this->assertText($node->title, $i . ': node title shown (search found the node) in search for number ' . $number); + $this->assertText($node->label(), $i . ': node title shown (search found the node) in search for number ' . $number); } } diff --git a/core/modules/search/lib/Drupal/search/Tests/SearchNumbersTest.php b/core/modules/search/lib/Drupal/search/Tests/SearchNumbersTest.php index a60db7008af7b538b9fe609086047f396d700cf5..dd119b9bf0da7e77fc41d2f32ffc43228d4a237a 100644 --- a/core/modules/search/lib/Drupal/search/Tests/SearchNumbersTest.php +++ b/core/modules/search/lib/Drupal/search/Tests/SearchNumbersTest.php @@ -83,14 +83,14 @@ function testNumberSearching() { $this->drupalPost('search/node', array('keys' => 'foo'), t('Search')); - $this->assertNoText($node->title, $type . ': node title not shown in dummy search'); + $this->assertNoText($node->label(), $type . ': node title not shown in dummy search'); // Verify that the node title does appear as a link on the search page // when searching for the number. $this->drupalPost('search/node', array('keys' => $number), t('Search')); - $this->assertText($node->title, $type . ': node title shown (search found the node) in search for number ' . $number); + $this->assertText($node->label(), $type . ': node title shown (search found the node) in search for number ' . $number); } } } diff --git a/core/modules/search/search.api.php b/core/modules/search/search.api.php index 0f43460697eb2776c8f13e97fabb7181343bbc25..fbccabddd04ab884d4312c7c957bdb49871a10ed 100644 --- a/core/modules/search/search.api.php +++ b/core/modules/search/search.api.php @@ -239,7 +239,7 @@ function hook_search_execute($keys = NULL, $conditions = NULL) { $results[] = array( 'link' => url('node/' . $item->sid, 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, @@ -351,7 +351,7 @@ function hook_update_index() { node_build_content($node, 'search_index'); $node->rendered = drupal_render($node->content); - $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); diff --git a/core/modules/search/search.module b/core/modules/search/search.module index bb1d7c8af8bbcd4f8fd3bf821254065e23953103..06c438444e2acd3a9ed2deeb929dbe8ecca41aca 100644 --- a/core/modules/search/search.module +++ b/core/modules/search/search.module @@ -646,6 +646,7 @@ function search_index($sid, $module, $text) { if ($linknid > 0) { $node = db_query('SELECT title, nid, vid FROM {node} WHERE nid = :nid', array(':nid' => $linknid), array('target' => 'slave'))->fetchObject(); $link = TRUE; + // Do not use $node->label(), $node comes from the database. $linktitle = $node->title; } } diff --git a/core/modules/statistics/lib/Drupal/statistics/Tests/StatisticsLoggingTest.php b/core/modules/statistics/lib/Drupal/statistics/Tests/StatisticsLoggingTest.php index e0a25f907e97cf5d48e368d39de3e143a6f665dc..d895564d7957548d59f1439d0483692e7431836e 100644 --- a/core/modules/statistics/lib/Drupal/statistics/Tests/StatisticsLoggingTest.php +++ b/core/modules/statistics/lib/Drupal/statistics/Tests/StatisticsLoggingTest.php @@ -58,7 +58,7 @@ function setUp() { function testLogging() { $path = 'node/' . $this->node->nid; $expected = array( - 'title' => $this->node->title, + 'title' => $this->node->label(), 'path' => $path, ); @@ -104,7 +104,7 @@ function testLogging() { // Visit edit page to generate a title greater than 255. $path = 'node/' . $this->node->nid . '/edit'; $expected = array( - 'title' => truncate_utf8(t('Edit Basic page') . ' ' . $this->node->title, 255), + 'title' => truncate_utf8(t('Edit Basic page') . ' ' . $this->node->label(), 255), 'path' => $path, ); $this->drupalGet($path); diff --git a/core/modules/statistics/lib/Drupal/statistics/Tests/StatisticsReportsTest.php b/core/modules/statistics/lib/Drupal/statistics/Tests/StatisticsReportsTest.php index 7c0007ab237b2176a51d9e61739abb9adda535c8..3df7347f57813e7a92ef73ba9a852553ed16fbd4 100644 --- a/core/modules/statistics/lib/Drupal/statistics/Tests/StatisticsReportsTest.php +++ b/core/modules/statistics/lib/Drupal/statistics/Tests/StatisticsReportsTest.php @@ -100,6 +100,6 @@ function testPopularContentBlock() { $this->assertText('All time', t('Found the alll time popular content.')); $this->assertText('Last viewed', t('Found the last viewed popular content.')); - $this->assertRaw(l($node->title, 'node/' . $node->nid), t('Found link to visited node.')); + $this->assertRaw(l($node->label(), 'node/' . $node->nid), t('Found link to visited node.')); } } diff --git a/core/modules/statistics/statistics.pages.inc b/core/modules/statistics/statistics.pages.inc index 90383bbc1e0435952dddc6173b22a8bc63a7ef76..d4ac0f855e0667756fafd7f5eccdf8760f184dcb 100644 --- a/core/modules/statistics/statistics.pages.inc +++ b/core/modules/statistics/statistics.pages.inc @@ -18,7 +18,6 @@ */ function statistics_node_tracker() { if ($node = node_load(arg(1))) { - $header = array( array('data' => t('Time'), 'field' => 'a.timestamp', 'sort' => 'desc'), array('data' => t('Referrer'), 'field' => 'a.url'), @@ -50,6 +49,7 @@ function statistics_node_tracker() { ); } + // Do not use $node->label() here, because $node comes from the database. drupal_set_title($node->title); $build['statistics_table'] = array( '#theme' => 'table', diff --git a/core/modules/tracker/lib/Drupal/tracker/Tests/TrackerTest.php b/core/modules/tracker/lib/Drupal/tracker/Tests/TrackerTest.php index 2706d3bda62dce660a5157901a2f699cb1cc9da6..168755e32b29ae02007f2387510fcb0b33bc08e4 100644 --- a/core/modules/tracker/lib/Drupal/tracker/Tests/TrackerTest.php +++ b/core/modules/tracker/lib/Drupal/tracker/Tests/TrackerTest.php @@ -65,14 +65,14 @@ function testTrackerAll() { )); $this->drupalGet('tracker'); - $this->assertNoText($unpublished->title, t('Unpublished node do not show up in the tracker listing.')); - $this->assertText($published->title, t('Published node show up in the tracker listing.')); + $this->assertNoText($unpublished->label(), t('Unpublished node do not show up in the tracker listing.')); + $this->assertText($published->label(), t('Published node show up in the tracker listing.')); $this->assertLink(t('My recent content'), 0, t('User tab shows up on the global tracker page.')); // Delete a node and ensure it no longer appears on the tracker. node_delete($published->nid); $this->drupalGet('tracker'); - $this->assertNoText($published->title, t('Deleted node do not show up in the tracker listing.')); + $this->assertNoText($published->label(), t('Deleted node do not show up in the tracker listing.')); } /** @@ -108,17 +108,17 @@ function testTrackerUser() { $this->drupalPost('comment/reply/' . $other_published_my_comment->nid, $comment, t('Save')); $this->drupalGet('user/' . $this->user->uid . '/track'); - $this->assertNoText($unpublished->title, t("Unpublished nodes do not show up in the users's tracker listing.")); - $this->assertText($my_published->title, t("Published nodes show up in the user's tracker listing.")); - $this->assertNoText($other_published_no_comment->title, t("Other user's nodes do not show up in the user's tracker listing.")); - $this->assertText($other_published_my_comment->title, t("Nodes that the user has commented on appear in the user's tracker listing.")); + $this->assertNoText($unpublished->label(), t("Unpublished nodes do not show up in the users's tracker listing.")); + $this->assertText($my_published->label(), t("Published nodes show up in the user's tracker listing.")); + $this->assertNoText($other_published_no_comment->label(), t("Other user's nodes do not show up in the user's tracker listing.")); + $this->assertText($other_published_my_comment->label(), t("Nodes that the user has commented on appear in the user's tracker listing.")); // Verify that unpublished comments are removed from the tracker. $admin_user = $this->drupalCreateUser(array('post comments', 'administer comments', 'access user profiles')); $this->drupalLogin($admin_user); $this->drupalPost('comment/1/edit', array('status' => COMMENT_NOT_PUBLISHED), t('Save')); $this->drupalGet('user/' . $this->user->uid . '/track'); - $this->assertNoText($other_published_my_comment->title, 'Unpublished comments are not counted on the tracker listing.'); + $this->assertNoText($other_published_my_comment->label(), 'Unpublished comments are not counted on the tracker listing.'); } /** @@ -230,7 +230,7 @@ function testTrackerCronIndexing() { // Assert that all node titles are displayed. foreach ($nodes as $i => $node) { - $this->assertText($node->title, t('Node @i is displayed on the tracker listing pages.', array('@i' => $i))); + $this->assertText($node->label(), t('Node @i is displayed on the tracker listing pages.', array('@i' => $i))); } $this->assertText('1 new', t('New comment is counted on the tracker listing pages.')); $this->assertText('updated', t('Node is listed as updated')); @@ -240,7 +240,7 @@ function testTrackerCronIndexing() { // Assert that all node titles are displayed. foreach ($nodes as $i => $node) { - $this->assertText($node->title, t('Node @i is displayed on the tracker listing pages.', array('@i' => $i))); + $this->assertText($node->label(), t('Node @i is displayed on the tracker listing pages.', array('@i' => $i))); } $this->assertText('1 new', t('New comment is counted on the tracker listing pages.')); } @@ -259,7 +259,7 @@ function testTrackerAdminUnpublish() { // Assert that the node is displayed. $this->drupalGet('tracker'); - $this->assertText($node->title, t('Node is displayed on the tracker listing pages.')); + $this->assertText($node->label(), t('Node is displayed on the tracker listing pages.')); // Unpublish the node and ensure that it's no longer displayed. $edit = array( diff --git a/core/modules/tracker/tracker.pages.inc b/core/modules/tracker/tracker.pages.inc index 3f9728d990ae9db52ddc52bfae54e0eef47536d0..a36bf13a59d4b6f68697680b0f02f9a2097117f1 100644 --- a/core/modules/tracker/tracker.pages.inc +++ b/core/modules/tracker/tracker.pages.inc @@ -70,6 +70,7 @@ function tracker_page($account = NULL, $set_title = FALSE) { $row = array( 'type' => check_plain(node_type_get_name($node->type)), + // Do not use $node->label(), because $node comes from the database. 'title' => array('data' => l($node->title, 'node/' . $node->nid) . ' ' . theme('mark', array('type' => node_mark($node->nid, $node->changed)))), 'author' => array('data' => theme('username', array('account' => $node))), 'replies' => array('class' => array('replies'), 'data' => $comments), diff --git a/core/modules/translation/lib/Drupal/translation/Tests/TranslationTest.php b/core/modules/translation/lib/Drupal/translation/Tests/TranslationTest.php index 2c2a4d219c8ce5024b7ac64ca8e9475b28708ecf..6b192080f4d7b14311e95ab9edc0c312b8808841 100644 --- a/core/modules/translation/lib/Drupal/translation/Tests/TranslationTest.php +++ b/core/modules/translation/lib/Drupal/translation/Tests/TranslationTest.php @@ -138,7 +138,7 @@ function testContentTranslation() { $this->drupalPost('admin/config/regional/language/delete/es', array(), t('Delete')); $this->drupalLogin($this->translator); $this->drupalGet('node/' . $node->nid . '/translate'); - $this->assertRaw(t('Translations of %title', array('%title' => $node->title)), t('Translation overview page available with only one language enabled.')); + $this->assertRaw(t('Translations of %title', array('%title' => $node->label())), t('Translation overview page available with only one language enabled.')); } /** @@ -345,7 +345,7 @@ function createTranslation(Node $node, $title, $body, $langcode) { $field_langcode = LANGUAGE_NOT_SPECIFIED; $body_key = "body[$field_langcode][0][value]"; - $this->assertFieldByXPath('//input[@id="edit-title"]', $node->title, "Original title value correctly populated."); + $this->assertFieldByXPath('//input[@id="edit-title"]', $node->label(), "Original title value correctly populated."); $this->assertFieldByXPath("//textarea[@name='$body_key']", $node->body[LANGUAGE_NOT_SPECIFIED][0]['value'], "Original body value correctly populated."); $edit = array(); diff --git a/core/modules/translation/translation.module b/core/modules/translation/translation.module index 347935e707ade6572a049cb4afeee6aaab180bd7..ba5c406eefb0d1c0ca2930b0c37aee2c991460ef 100644 --- a/core/modules/translation/translation.module +++ b/core/modules/translation/translation.module @@ -296,7 +296,7 @@ function translation_node_prepare(Node $node) { if (!empty($source_node->tnid)) { $translations = translation_node_get_translations($source_node->tnid); if (isset($translations[$langcode])) { - drupal_set_message(t('A translation of %title in %language already exists, a new %type will be created instead of a translation.', array('%title' => $source_node->title, '%language' => $language_list[$langcode]->name, '%type' => $node->type)), 'error'); + drupal_set_message(t('A translation of %title in %language already exists, a new %type will be created instead of a translation.', array('%title' => $source_node->label(), '%language' => $language_list[$langcode]->name, '%type' => $node->type)), 'error'); return; } } diff --git a/core/modules/translation/translation.pages.inc b/core/modules/translation/translation.pages.inc index a6e8b3c26cbd389febf1d93ffb108886ba6a79f6..a501870a9bd21f58baf7e8b134d1fe13b0639241 100644 --- a/core/modules/translation/translation.pages.inc +++ b/core/modules/translation/translation.pages.inc @@ -44,7 +44,7 @@ function translation_node_overview(Node $node) { $translation_node = node_load($translations[$langcode]->nid); $path = 'node/' . $translation_node->nid; $links = language_negotiation_get_switch_links($type, $path); - $title = empty($links->links[$langcode]['href']) ? l($translation_node->title, $path) : l($translation_node->title, $links->links[$langcode]['href'], $links->links[$langcode]); + $title = empty($links->links[$langcode]['href']) ? l($translation_node->label(), $path) : l($translation_node->label(), $links->links[$langcode]['href'], $links->links[$langcode]); if (node_access('update', $translation_node)) { $text = t('edit'); $path = 'node/' . $translation_node->nid . '/edit'; @@ -72,7 +72,7 @@ function translation_node_overview(Node $node) { $rows[] = array($language_name, $title, $status, implode(" | ", $options)); } - drupal_set_title(t('Translations of %title', array('%title' => $node->title)), PASS_THROUGH); + drupal_set_title(t('Translations of %title', array('%title' => $node->label())), PASS_THROUGH); $build['translation_node_overview'] = array( '#theme' => 'table',