public function HelpTopicPluginBase::toLink in Drupal 9
Same name and namespace in other branches
- 8 core/modules/help_topics/src/HelpTopicPluginBase.php \Drupal\help_topics\HelpTopicPluginBase::toLink()
Returns a link for viewing the help topic.
Parameters
string|null $text: (optional) Link text to use for the link. If NULL, defaults to the topic title.
array $options: (optional) See \Drupal\Core\Routing\UrlGeneratorInterface::generateFromRoute() for the available options.
Return value
\Drupal\Core\Link A link object for viewing the topic.
Overrides HelpTopicPluginInterface::toLink
File
- core/
modules/ help_topics/ src/ HelpTopicPluginBase.php, line 57
Class
- HelpTopicPluginBase
- Base class for help topic plugins.
Namespace
Drupal\help_topicsCode
public function toLink($text = NULL, array $options = []) {
if (!$text) {
$text = $this
->getLabel();
}
return Link::createFromRoute($text, 'help.help_topic', [
'id' => $this
->getPluginId(),
], $options);
}