diff --git a/core/modules/forum/forum.module b/core/modules/forum/forum.module index 54b687d..61bb7f1 100644 --- a/core/modules/forum/forum.module +++ b/core/modules/forum/forum.module @@ -751,6 +751,7 @@ function forum_forum_load($tid = NULL) { $topic = $query ->fields('ncs', array('last_comment_timestamp', 'last_comment_uid')) + ->fields('n', array('type')) ->condition('n.status', 1) // @todo This should be actually filtering on the desired node status // field language and just fall back to the default language. @@ -762,13 +763,16 @@ function forum_forum_load($tid = NULL) { ->fetchObject(); // Merge in the "Last Post" information. - $last_post = new stdClass(); + // @todo: Find a better way to do this, this is crazy. if (!empty($topic->last_comment_timestamp)) { - $last_post->created = $topic->last_comment_timestamp; - $last_post->name = $topic->last_comment_name; - $last_post->uid = $topic->last_comment_uid; + $values = array( + 'type' => $topic->type, + ); + $values['created'] = $topic->last_comment_timestamp; + $values['name'] = $topic->last_comment_name; + $values['uid'] = $topic->last_comment_uid; + $forum->last_post = entity_create('node', $values); } - $forum->last_post = $last_post; $forums[$forum->id()] = $forum; } diff --git a/core/modules/node/lib/Drupal/node/NodeFormController.php b/core/modules/node/lib/Drupal/node/NodeFormController.php index 75dd42f..bb7b268 100644 --- a/core/modules/node/lib/Drupal/node/NodeFormController.php +++ b/core/modules/node/lib/Drupal/node/NodeFormController.php @@ -115,7 +115,7 @@ public function form(array $form, array &$form_state) { $form['langcode'] = array( '#title' => t('Language'), '#type' => 'language_select', - '#default_value' => $node->language()->id, + '#default_value' => $node->getUntranslated()->language()->id, '#languages' => Language::STATE_ALL, '#access' => isset($language_configuration['language_show']) && $language_configuration['language_show'], ); diff --git a/core/modules/node/lib/Drupal/node/NodeTranslationController.php b/core/modules/node/lib/Drupal/node/NodeTranslationController.php index 4df3946..9436996 100644 --- a/core/modules/node/lib/Drupal/node/NodeTranslationController.php +++ b/core/modules/node/lib/Drupal/node/NodeTranslationController.php @@ -54,7 +54,7 @@ public function entityFormEntityBuild($entity_type, EntityInterface $entity, arr if (isset($form_state['values']['content_translation'])) { $form_controller = content_translation_form_controller($form_state); $translation = &$form_state['values']['content_translation']; - $translation['status'] = $form_controller->getEntity()->status; + $translation['status'] = $form_controller->getEntity()->isPublished(); $translation['name'] = $form_state['values']['name']; $translation['created'] = $form_state['values']['date']; } diff --git a/core/modules/node/lib/Drupal/node/Tests/NodeRevisionsAllTestCase.php b/core/modules/node/lib/Drupal/node/Tests/NodeRevisionsAllTestCase.php index 00a9963..5a98ec8 100644 --- a/core/modules/node/lib/Drupal/node/Tests/NodeRevisionsAllTestCase.php +++ b/core/modules/node/lib/Drupal/node/Tests/NodeRevisionsAllTestCase.php @@ -129,7 +129,7 @@ function testRevisions() { $this->drupalPost("node/" . $node->id() . "/revisions/" . $nodes[1]->getRevisionId() . "/delete", array(), t('Delete')); $this->assertRaw(t('Revision from %revision-date of @type %title has been deleted.', array( - '%revision-date' => format_date($nodes[1]->getRevisionCreatedTime()), + '%revision-date' => format_date($nodes[1]->getRevisionCreationTime()), '@type' => 'Basic page', '%title' => $nodes[1]->title, )), diff --git a/core/modules/path/lib/Drupal/path/Tests/PathLanguageTest.php b/core/modules/path/lib/Drupal/path/Tests/PathLanguageTest.php index 5a12f60..1724a4a 100644 --- a/core/modules/path/lib/Drupal/path/Tests/PathLanguageTest.php +++ b/core/modules/path/lib/Drupal/path/Tests/PathLanguageTest.php @@ -86,6 +86,11 @@ function testAliasTranslation() { // Clear the path lookup cache. $this->container->get('path.alias_manager')->cacheClear(); + // Languages are cached on many levels, and we need to clear those caches. + drupal_static_reset('language_list'); + $this->rebuildContainer(); + $languages = language_list(); + // Ensure the node was created. $french_node = $this->drupalGetNodeByTitle($edit["title"]); $this->assertTrue(($french_node), 'Node found in database.'); @@ -94,11 +99,7 @@ function testAliasTranslation() { $this->drupalGet('fr/' . $edit['path[alias]']); $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. - drupal_static_reset('language_list'); - $this->rebuildContainer(); - $languages = language_list(); + // Confirm that the alias is returned by url(). $url = $this->container->get('url_generator')->generateFromPath('node/' . $french_node->id(), array('language' => $languages[$french_node->language()->id])); $this->assertTrue(strpos($url, $edit['path[alias]']), 'URL contains the path alias.'); diff --git a/core/modules/system/lib/Drupal/system/Tests/Menu/BreadcrumbTest.php b/core/modules/system/lib/Drupal/system/Tests/Menu/BreadcrumbTest.php index ff71e2c..493e8d6 100644 --- a/core/modules/system/lib/Drupal/system/Tests/Menu/BreadcrumbTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/Menu/BreadcrumbTest.php @@ -175,15 +175,15 @@ function testBreadCrumbs() { $trail = $home; $this->assertBreadcrumb("node/$nid1", $trail); // Also verify that the node does not appear elsewhere (e.g., menu trees). - $this->assertNoLink($node1->title); + $this->assertNoLink($node1->label()); // The node itself should not be contained in the breadcrumb on the default // local task, since there is no difference between both pages. $this->assertBreadcrumb("node/$nid1/view", $trail); // Also verify that the node does not appear elsewhere (e.g., menu trees). - $this->assertNoLink($node1->title); + $this->assertNoLink($node1->label()); $trail += array( - "node/$nid1" => $node1->title, + "node/$nid1" => $node1->label(), ); $this->assertBreadcrumb("node/$nid1/edit", $trail); @@ -221,10 +221,10 @@ function testBreadCrumbs() { $tree = array( "node/$nid2" => $node2->menu['link_title'], ); - $this->assertBreadcrumb("node/$nid2", $trail, $node2->title, $tree); + $this->assertBreadcrumb("node/$nid2", $trail, $node2->label(), $tree); // The node itself should not be contained in the breadcrumb on the // default local task, since there is no difference between both pages. - $this->assertBreadcrumb("node/$nid2/view", $trail, $node2->title, $tree); + $this->assertBreadcrumb("node/$nid2/view", $trail, $node2->label(), $tree); $trail += array( "node/$nid2" => $node2->menu['link_title'], ); @@ -245,10 +245,10 @@ function testBreadCrumbs() { )); $nid3 = $node3->id(); - $this->assertBreadcrumb("node/$nid3", $trail, $node3->title, $tree, FALSE); + $this->assertBreadcrumb("node/$nid3", $trail, $node3->label(), $tree, FALSE); // The node itself should not be contained in the breadcrumb on the // default local task, since there is no difference between both pages. - $this->assertBreadcrumb("node/$nid3/view", $trail, $node3->title, $tree, FALSE); + $this->assertBreadcrumb("node/$nid3/view", $trail, $node3->label(), $tree, FALSE); $trail += array( "node/$nid3" => $node3->menu['link_title'], ); @@ -351,7 +351,7 @@ function testBreadCrumbs() { $link['link_path'] => $link['link_title'], ); $this->assertBreadcrumb($link['link_path'], $trail, $term->label(), $tree); - $this->assertRaw(check_plain($parent->title), 'Tagged node found.'); + $this->assertRaw(check_plain($parent->label()), 'Tagged node found.'); // Additionally make sure that this link appears only once; i.e., the // untranslated menu links automatically generated from menu router items diff --git a/core/modules/tracker/tracker.pages.inc b/core/modules/tracker/tracker.pages.inc index f624628..e73fa4f 100644 --- a/core/modules/tracker/tracker.pages.inc +++ b/core/modules/tracker/tracker.pages.inc @@ -82,8 +82,8 @@ function tracker_page($account = NULL, $set_title = FALSE) { $row = array( 'type' => check_plain(node_get_type_label($node)), // Do not use $node->label(), because $node comes from the database. - 'title' => array('data' => l($node->title, 'node/' . $node->id()) . ' ' . drupal_render($mark_build)), - 'author' => array('data' => array('#theme' => 'username', '#account' => user_load($node->uid))), + 'title' => array('data' => l($node->label(), 'node/' . $node->id()) . ' ' . drupal_render($mark_build)), + 'author' => array('data' => array('#theme' => 'username', '#account' => $node->getAuthor())), 'replies' => array('class' => array('replies'), 'data' => $comments), 'last updated' => array('data' => t('!time ago', array('!time' => format_interval(REQUEST_TIME - $node->last_activity)))), );