diff --git a/core/modules/node/lib/Drupal/node/Plugin/Search/NodeSearch.php b/core/modules/node/lib/Drupal/node/Plugin/Search/NodeSearch.php index 3a92be1..bf987e6 100644 --- a/core/modules/node/lib/Drupal/node/Plugin/Search/NodeSearch.php +++ b/core/modules/node/lib/Drupal/node/Plugin/Search/NodeSearch.php @@ -229,10 +229,7 @@ public function execute() { foreach ($find as $item) { // Render the node. - $entities = $node_storage->loadMultiple(array($item->sid)); - // Convert to BCEntity to match node_load_multiple(). - // @todo - remove this when code that receives this object is updated. - $node = $entities[$item->sid]->getBCEntity(); + $node = $node_storage->load($item->sid); $build = $node_render->view($node, 'search_result', $item->langcode); unset($build['#theme']); $node->rendered = drupal_render($build); @@ -246,7 +243,7 @@ public function execute() { $uri = $node->uri(); $username = array( '#theme' => 'username', - '#account' => $this->entityManager->getStorageController('user')->load($node->uid), + '#account' => $node->getAuthor(), ); $results[] = array( 'link' => url($uri['path'], array_merge($uri['options'], array('absolute' => TRUE, 'language' => $language))), @@ -303,10 +300,7 @@ public function updateIndex() { // of a node. $counter = 0; $node_storage = $this->entityManager->getStorageController('node'); - foreach ($node_storage->loadMultiple($nids) as $entity) { - // Convert to BCEntity to match node_load_multiple(). - // @todo - remove this when hooks passed this object are updated. - $node = $entity->getBCEntity(); + foreach ($node_storage->loadMultiple($nids) as $node) { // Determine when the maximum number of indexable items is reached. $counter += count($node->getTranslationLanguages()); if ($counter > $limit) { diff --git a/core/modules/search/lib/Drupal/search/Tests/SearchMultilingualEntityTest.php b/core/modules/search/lib/Drupal/search/Tests/SearchMultilingualEntityTest.php index a6cb06f..40ed3dc 100644 --- a/core/modules/search/lib/Drupal/search/Tests/SearchMultilingualEntityTest.php +++ b/core/modules/search/lib/Drupal/search/Tests/SearchMultilingualEntityTest.php @@ -120,8 +120,10 @@ function testSearchingMultilingualFieldValues() { search_update_totals(); foreach ($this->searchable_nodes as $node) { // Each searchable node that we created contains values in the body field - // in one or more languages. - $plugin->setSearch($node->body->value, array(), array()); + // in one or more languages. Let's pick the last language variant from the + // body array and execute a search using that as a search keyword. + $languages = $node->getTranslationLanguages(); + $plugin->setSearch($node->getTranslation(end($languages)->id)->body->value, array(), array()); // Do the search and assert the results. $search_result = $plugin->execute(); // See whether we get the same node as a result.