HelpTopicPluginBase.php in Drupal 8
File
core/modules/help_topics/src/HelpTopicPluginBase.php
View source
<?php
namespace Drupal\help_topics;
use Drupal\Core\Link;
use Drupal\Core\Plugin\PluginBase;
use Drupal\Core\Url;
abstract class HelpTopicPluginBase extends PluginBase implements HelpTopicPluginInterface {
public function getProvider() {
return $this->pluginDefinition['provider'];
}
public function getLabel() {
return $this->pluginDefinition['label'];
}
public function isTopLevel() {
return $this->pluginDefinition['top_level'];
}
public function getRelated() {
return $this->pluginDefinition['related'];
}
public function toUrl(array $options = []) {
return Url::fromRoute('help.help_topic', [
'id' => $this
->getPluginId(),
], $options);
}
public function toLink($text = NULL, array $options = []) {
if (!$text) {
$text = $this
->getLabel();
}
return Link::createFromRoute($text, 'help.help_topic', [
'id' => $this
->getPluginId(),
], $options);
}
}