You are here

abstract class HelpTopicPluginBase in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/help_topics/src/HelpTopicPluginBase.php \Drupal\help_topics\HelpTopicPluginBase
  2. 9 core/modules/help_topics/src/HelpTopicPluginBase.php \Drupal\help_topics\HelpTopicPluginBase

Base class for help topic plugins.

@internal Help Topics is currently experimental and should only be leveraged by experimental modules and development releases of contributed modules. See https://www.drupal.org/core/experimental for more information.

Hierarchy

Expanded class hierarchy of HelpTopicPluginBase

1 file declares its use of HelpTopicPluginBase
TestHelpTopicPlugin.php in core/modules/help_topics/tests/modules/help_topics_test/src/Plugin/HelpTopic/TestHelpTopicPlugin.php

File

core/modules/help_topics/src/HelpTopicPluginBase.php, line 17

Namespace

Drupal\help_topics
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);
  }

}

Members