class HelpTopicPluginBase

Same name in this branch
  1. 10 core/modules/help_topics/src/HelpTopicPluginBase.php \Drupal\help_topics\HelpTopicPluginBase
Same name and namespace in other branches
  1. 11.x core/modules/help/src/HelpTopicPluginBase.php \Drupal\help\HelpTopicPluginBase

Base class for help topic plugins.

@internal Plugin classes are internal.

Hierarchy

  • class \Drupal\help\HelpTopicPluginBase implements \Drupal\help\HelpTopicPluginInterface extends \Drupal\Core\Plugin\PluginBase

Expanded class hierarchy of HelpTopicPluginBase

2 files declare their use of HelpTopicPluginBase
HelpTopicPluginBase.php in core/modules/help_topics/src/HelpTopicPluginBase.php
TestHelpTopicPlugin.php in core/modules/help/tests/modules/help_topics_test/src/Plugin/HelpTopic/TestHelpTopicPlugin.php

File

core/modules/help/src/HelpTopicPluginBase.php, line 15

Namespace

Drupal\help
View source
abstract class HelpTopicPluginBase extends PluginBase implements HelpTopicPluginInterface {
  
  /**
   * The name of the module or theme providing the help topic.
   */
  public function getProvider() {
    return $this->pluginDefinition['provider'];
  }
  
  /**
   * {@inheritdoc}
   */
  public function getLabel() {
    return $this->pluginDefinition['label'];
  }
  
  /**
   * {@inheritdoc}
   */
  public function isTopLevel() {
    return $this->pluginDefinition['top_level'];
  }
  
  /**
   * {@inheritdoc}
   */
  public function getRelated() {
    return $this->pluginDefinition['related'];
  }
  
  /**
   * {@inheritdoc}
   */
  public function toUrl(array $options = []) {
    return Url::fromRoute('help.help_topic', [
      'id' => $this->getPluginId(),
    ], $options);
  }
  
  /**
   * {@inheritdoc}
   */
  public function toLink($text = NULL, array $options = []) {
    if (!$text) {
      $text = $this->getLabel();
    }
    return Link::createFromRoute($text, 'help.help_topic', [
      'id' => $this->getPluginId(),
    ], $options);
  }

}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.