SearchableHelpInterface.php

Same filename in this branch
  1. 10 core/modules/help_topics/src/SearchableHelpInterface.php
Same filename in other branches
  1. 9 core/modules/help_topics/src/SearchableHelpInterface.php
  2. 8.9.x core/modules/help_topics/src/SearchableHelpInterface.php
  3. 11.x core/modules/help_topics/src/SearchableHelpInterface.php
  4. 11.x core/modules/help/src/SearchableHelpInterface.php

Namespace

Drupal\help

File

core/modules/help/src/SearchableHelpInterface.php

View source
<?php

namespace Drupal\help;

use Drupal\Core\Language\LanguageInterface;

/**
 * Provides an interface for a HelpSection plugin that also supports search.
 *
 * @see \Drupal\help\HelpSectionPluginInterface
 */
interface SearchableHelpInterface {
    
    /**
     * Returns the IDs of topics that should be indexed for searching.
     *
     * @return string[]
     *   An array of topic IDs that should be searchable. IDs need to be
     *   unique within this HelpSection plugin.
     */
    public function listSearchableTopics();
    
    /**
     * Renders one topic for search indexing or search results.
     *
     * @param string $topic_id
     *   The ID of the topic to be indexed.
     * @param \Drupal\Core\Language\LanguageInterface $language
     *   The language to render the topic in.
     *
     * @return array
     *   An array of information about the topic, with elements:
     *   - title: The title of the topic in this language.
     *   - text: The text of the topic in this language.
     *   - url: The URL of the topic as a \Drupal\Core\Url object.
     *   - cacheable_metadata: (optional) An object to add as a cache dependency
     *     if this topic is shown in search results.
     */
    public function renderTopicForSearch($topic_id, LanguageInterface $language);

}

Interfaces

Title Deprecated Summary
SearchableHelpInterface Provides an interface for a HelpSection plugin that also supports search.

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