Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x

HelpTopicPluginBase.php

Namespace

Drupal\help

File

core/modules/help/src/HelpTopicPluginBase.php

View source
<?php

namespace Drupal\help;

use Drupal\Core\Link;
use Drupal\Core\Plugin\PluginBase;
use Drupal\Core\Url;

/**
 * Base class for help topic plugins.
 *
 * @internal
 *   Plugin classes are internal.
 */
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);
    }

}

Classes

Title Deprecated Summary
HelpTopicPluginBase Base class for help topic plugins.

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal