Commit 3d1ed15e authored by larowlan's avatar larowlan

Issue #3087661 by andypost, jhodgdon, pwolanin: Remove pass by reference in NodeSearch plugin

(cherry picked from commit 89e11e4d)
parent 4f3e3a61
......@@ -497,7 +497,7 @@ public function updateIndex() {
$words = [];
try {
foreach ($node_storage->loadMultiple($nids) as $node) {
$this->indexNode($node, $words);
$words += $this->indexNode($node);
}
}
finally {
......@@ -510,10 +510,12 @@ public function updateIndex() {
*
* @param \Drupal\node\NodeInterface $node
* The node to index.
* @param array $words
* Words that need updating after the index run.
*
* @return array
* An array of words to update after indexing.
*/
protected function indexNode(NodeInterface $node, array &$words) {
protected function indexNode(NodeInterface $node) {
$words = [];
$languages = $node->getTranslationLanguages();
$node_render = $this->entityTypeManager->getViewBuilder('node');
......@@ -542,6 +544,7 @@ protected function indexNode(NodeInterface $node, array &$words) {
// Update index, using search index "type" equal to the plugin ID.
$words += $this->searchIndex->index($this->getPluginId(), $node->id(), $language->getId(), $text, FALSE);
}
return $words;
}
/**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment