/** @var \Drupal\help_topics\HelpTopicPluginInterface $help_topic */
$help_topic =
$this->helpTopicPluginManager->
createInstance($id);
$build['#body'
] =
$help_topic->
getBody();
$this->renderer->
addCacheableDependency($build,
$help_topic);
// Build the related topics section, starting with the list this topic
// says are related.
$links =
[];
$related =
$help_topic->
getRelated();
foreach ($related as $other_id) { if ($other_id !==
$id) { /** @var \Drupal\help_topics\HelpTopicPluginInterface $topic */
$topic =
$this->helpTopicPluginManager->
createInstance($other_id);
$links[$other_id] =
[ 'title' =>
$topic->
getLabel(),
'url' => Url::
fromRoute('help.help_topic',
['id' =>
$other_id]),
];
$this->renderer->
addCacheableDependency($build,
$topic);
} }