HelpTopicPluginInterface.php

Same filename and directory in other branches
  1. 9 core/modules/help_topics/src/HelpTopicPluginInterface.php
  2. 10 core/modules/help_topics/src/HelpTopicPluginInterface.php
  3. 10 core/modules/help/src/HelpTopicPluginInterface.php
  4. 11.x core/modules/help_topics/src/HelpTopicPluginInterface.php
  5. 11.x core/modules/help/src/HelpTopicPluginInterface.php

Namespace

Drupal\help_topics

File

core/modules/help_topics/src/HelpTopicPluginInterface.php

View source
<?php

namespace Drupal\help_topics;

use Drupal\Component\Plugin\PluginInspectionInterface;
use Drupal\Component\Plugin\DerivativeInspectionInterface;
use Drupal\Core\Cache\CacheableDependencyInterface;

/**
 * Defines an interface for help topic plugin classes.
 *
 * @see \Drupal\help_topics\HelpTopicPluginManager
 *
 * @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.
 */
interface HelpTopicPluginInterface extends PluginInspectionInterface, DerivativeInspectionInterface, CacheableDependencyInterface {
    
    /**
     * Returns the label of the topic.
     *
     * @return string
     *   The label of the topic.
     */
    public function getLabel();
    
    /**
     * Returns the body of the topic.
     *
     * @return array
     *   A render array representing the body.
     */
    public function getBody();
    
    /**
     * Returns whether this is a top-level topic or not.
     *
     * @return bool
     *   TRUE if this is a topic that should be displayed on the Help topics
     *   list; FALSE if not.
     */
    public function isTopLevel();
    
    /**
     * Returns the IDs of related topics.
     *
     * @return string[]
     *   Array of the IDs of related topics.
     */
    public function getRelated();
    
    /**
     * Returns the URL for viewing the help topic.
     *
     * @param array $options
     *   (optional) See
     *   \Drupal\Core\Routing\UrlGeneratorInterface::generateFromRoute() for the
     *    available options.
     *
     * @return \Drupal\Core\Url
     *   A URL object containing the URL for viewing the help topic.
     */
    public function toUrl(array $options = []);
    
    /**
     * Returns a link for viewing the help topic.
     *
     * @param string|null $text
     *   (optional) Link text to use for the link. If NULL, defaults to the
     *   topic title.
     * @param array $options
     *   (optional) See
     *   \Drupal\Core\Routing\UrlGeneratorInterface::generateFromRoute() for the
     *    available options.
     *
     * @return \Drupal\Core\Link
     *   A link object for viewing the topic.
     */
    public function toLink($text = NULL, array $options = []);

}

Interfaces

Title Deprecated Summary
HelpTopicPluginInterface Defines an interface for help topic plugin classes.

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