diff --git a/core/modules/help_topics/src/Plugin/HelpSection/HelpTopicSection.php b/core/modules/help_topics/src/Plugin/HelpSection/HelpTopicSection.php index c604d650ae..9627c99876 100644 --- a/core/modules/help_topics/src/Plugin/HelpSection/HelpTopicSection.php +++ b/core/modules/help_topics/src/Plugin/HelpSection/HelpTopicSection.php @@ -12,7 +12,6 @@ use Drupal\Core\Plugin\ContainerFactoryPluginInterface; use Drupal\help\Plugin\HelpSection\HelpSectionPluginBase; use Drupal\Core\Render\RendererInterface; -use Drupal\Core\Render\RenderContext; use Drupal\Core\StringTranslation\TranslationManager; use Symfony\Component\DependencyInjection\ContainerInterface; @@ -234,19 +233,13 @@ public function renderTopicForSearch($topic_id, LanguageInterface $language) { $topic['title'] = $this->renderer->renderPlain($title_build); $cacheable_metadata = CacheableMetadata::createFromRenderArray($title_build); - // Render the body in this language. For this, we need to set up a render - // context, because the Twig plugins that provide the body assumes one - // is present. - $context = new RenderContext(); + // Render the body in this language. $build = [ - 'body' => $this->renderer->executeInRenderContext($context, [$plugin, 'getBody']), + 'body' => $plugin->getBody(), ]; $topic['text'] = $this->renderer->renderPlain($build); $cacheable_metadata->addCacheableDependency(CacheableMetadata::createFromRenderArray($build)); $cacheable_metadata->addCacheableDependency($plugin); - if (!$context->isEmpty()) { - $cacheable_metadata->addCacheableDependency($context->pop()); - } // Add the other information. $topic['url'] = $plugin->toUrl(); diff --git a/core/modules/help_topics/src/Plugin/Search/HelpSearch.php b/core/modules/help_topics/src/Plugin/Search/HelpSearch.php index bb2f2eb1f3..61d8d67a1e 100644 --- a/core/modules/help_topics/src/Plugin/Search/HelpSearch.php +++ b/core/modules/help_topics/src/Plugin/Search/HelpSearch.php @@ -218,6 +218,7 @@ protected function findResults() { $find = $query ->fields('i', ['langcode']) + ->fields('hsi', ['section_plugin_id', 'topic_id']) // Since SearchQuery makes these into GROUP BY queries, if we add // a field, for PostgreSQL we also need to make it an aggregate or a // GROUP BY. In this case, we want GROUP BY. @@ -258,11 +259,7 @@ protected function prepareResults(StatementInterface $found) { $languages = []; $keys = $this->getKeywords(); foreach ($found as $item) { - $record = $this->database->select('help_search_items', 'hsi') - ->condition('sid', $item->sid) - ->fields('hsi', ['section_plugin_id', 'topic_id']) - ->execute()->fetchObject(); - $section_plugin_id = $record->section_plugin_id; + $section_plugin_id = $item->section_plugin_id; if (!isset($plugins[$section_plugin_id])) { $plugins[$section_plugin_id] = $this->getSectionPlugin($section_plugin_id); } @@ -271,7 +268,7 @@ protected function prepareResults(StatementInterface $found) { if (!isset($languages[$langcode])) { $languages[$langcode] = $this->languageManager->getLanguage($item->langcode); } - $topic = $plugins[$section_plugin_id]->renderTopicForSearch($record->topic_id, $languages[$langcode]); + $topic = $plugins[$section_plugin_id]->renderTopicForSearch($item->topic_id, $languages[$langcode]); if ($topic) { if (isset($topic['cacheable_metadata'])) { $this->addCacheableDependency($topic['cacheable_metadata']);