class HelpSearch

Same name and namespace in other branches
  1. 11.x core/modules/help/src/Plugin/Search/HelpSearch.php \Drupal\help\Plugin\Search\HelpSearch
  2. 10 core/modules/help_topics/src/Plugin/Search/HelpSearch.php \Drupal\help_topics\Plugin\Search\HelpSearch
  3. 10 core/modules/help/src/Plugin/Search/HelpSearch.php \Drupal\help\Plugin\Search\HelpSearch
  4. 9 core/modules/help_topics/src/Plugin/Search/HelpSearch.php \Drupal\help_topics\Plugin\Search\HelpSearch
  5. 8.9.x core/modules/help_topics/src/Plugin/Search/HelpSearch.php \Drupal\help_topics\Plugin\Search\HelpSearch

Handles searching for help using the Search module index.

Help items are indexed if their HelpSection plugin implements \Drupal\help\HelpSearchInterface.

@internal Plugin classes are internal.

Attributes

#[Search(id: 'help_search', title: new TranslatableMarkup('Help'), use_admin_theme: TRUE)]

Hierarchy

Expanded class hierarchy of HelpSearch

Deprecated

in drupal:11.4.0 and is removed from drupal:12.0.0. Instead, use \Drupal\search_help\Plugin\Search\HelpSearch.

See also

\Drupal\help\HelpSearchInterface

\Drupal\help\HelpSectionPluginInterface

https://www.drupal.org/node/3581109

1 file declares its use of HelpSearch
HelpTopicSearchTest.php in core/modules/help/tests/src/Functional/HelpTopicSearchTest.php

File

core/modules/help/src/Plugin/Search/HelpSearch.php, line 37

Namespace

Drupal\help\Plugin\Search
View source
class HelpSearch extends SearchPluginBase implements AccessibleInterface, SearchIndexingInterface {
  
  /**
   * The current database connection.
   *
   * @var \Drupal\Core\Database\Connection
   */
  protected $database;
  
  /**
   * A config object for 'search.settings'.
   *
   * @var \Drupal\Core\Config\Config
   */
  protected $searchSettings;
  
  /**
   * The language manager.
   *
   * @var \Drupal\Core\Language\LanguageManagerInterface
   */
  protected $languageManager;
  
  /**
   * The Drupal account to use for checking for access to search.
   *
   * @var \Drupal\Core\Session\AccountInterface
   */
  protected $account;
  
  /**
   * The messenger.
   *
   * @var \Drupal\Core\Messenger\MessengerInterface
   */
  protected $messenger;
  
  /**
   * The state object.
   *
   * @var \Drupal\Core\State\StateInterface
   */
  protected $state;
  
  /**
   * The help section plugin manager.
   *
   * @var \Drupal\help\HelpSectionManager
   */
  protected $helpSectionManager;
  
  /**
   * The search index.
   *
   * @var \Drupal\search\SearchIndexInterface
   */
  protected $searchIndex;
  
  /**
   * {@inheritdoc}
   */
  public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) {
    return new static($configuration, $plugin_id, $plugin_definition, $container->get('database'), $container->get('config.factory')
      ->get('search.settings'), $container->get('language_manager'), $container->get('messenger'), $container->get('current_user'), $container->get('state'), $container->get('plugin.manager.help_section'), $container->get('search.index'));
  }
  
  /**
   * Constructs a \Drupal\help_search\Plugin\Search\HelpSearch object.
   *
   * @param array $configuration
   *   Configuration for the plugin.
   * @param string $plugin_id
   *   The plugin ID for the plugin instance.
   * @param mixed $plugin_definition
   *   The plugin implementation definition.
   * @param \Drupal\Core\Database\Connection $database
   *   The current database connection.
   * @param \Drupal\Core\Config\Config $search_settings
   *   A config object for 'search.settings'.
   * @param \Drupal\Core\Language\LanguageManagerInterface $language_manager
   *   The language manager.
   * @param \Drupal\Core\Messenger\MessengerInterface $messenger
   *   The messenger.
   * @param \Drupal\Core\Session\AccountInterface $account
   *   The $account object to use for checking for access to view help.
   * @param \Drupal\Core\State\StateInterface $state
   *   The state object.
   * @param \Drupal\help\HelpSectionManager $help_section_manager
   *   The help section manager.
   * @param \Drupal\search\SearchIndexInterface $search_index
   *   The search index.
   */
  public function __construct(array $configuration, $plugin_id, $plugin_definition, Connection $database, Config $search_settings, LanguageManagerInterface $language_manager, MessengerInterface $messenger, AccountInterface $account, StateInterface $state, HelpSectionManager $help_section_manager, SearchIndexInterface $search_index) {
    @trigger_error(__CLASS__ . ' is deprecated in drupal:11.4.0 and is removed from drupal:12.0.0. Instead, use \\Drupal\\search_help\\Plugin\\Search\\HelpSearch. See https://www.drupal.org/node/3581109', E_USER_DEPRECATED);
    parent::__construct($configuration, $plugin_id, $plugin_definition);
    $this->database = $database;
    $this->searchSettings = $search_settings;
    $this->languageManager = $language_manager;
    $this->messenger = $messenger;
    $this->account = $account;
    $this->state = $state;
    $this->helpSectionManager = $help_section_manager;
    $this->searchIndex = $search_index;
  }
  
  /**
   * {@inheritdoc}
   */
  public function access($operation = 'view', ?AccountInterface $account = NULL, $return_as_object = FALSE) {
    return AccessResult::forbidden();
  }
  
  /**
   * {@inheritdoc}
   */
  public function execute() {
    return [];
  }
  
  /**
   * {@inheritdoc}
   */
  public function updateIndex() {
  }
  
  /**
   * {@inheritdoc}
   */
  public function indexClear() {
  }
  
  /**
   * {@inheritdoc}
   */
  public function markForReindex() {
  }
  
  /**
   * {@inheritdoc}
   */
  public function indexStatus() {
    return [];
  }

}

Members

Title Sort descending Modifiers Object type Summary Overriden Title Overrides
AutowiredInstanceTrait::createInstanceAutowired public static function Instantiates a new instance of the implementing class using autowiring.
AutowiredInstanceTrait::getAutowireArguments private static function Resolves arguments for a method using autowiring.
CacheableDependencyTrait::$cacheContexts protected property Cache contexts.
CacheableDependencyTrait::$cacheMaxAge protected property Cache max-age.
CacheableDependencyTrait::$cacheTags protected property Cache tags.
CacheableDependencyTrait::getCacheContexts public function 4
CacheableDependencyTrait::getCacheMaxAge public function 4
CacheableDependencyTrait::getCacheTags public function 4
CacheableDependencyTrait::setCacheability protected function Sets cacheability; useful for value object constructors.
DependencySerializationTrait::$_entityStorages protected property An array of entity type IDs keyed by the property name of their storages.
DependencySerializationTrait::$_serviceIds protected property An array of service IDs keyed by property name used for serialization.
DependencySerializationTrait::__sleep public function 2
DependencySerializationTrait::__wakeup public function 2
HelpSearch::$account protected property The Drupal account to use for checking for access to search.
HelpSearch::$database protected property The current database connection.
HelpSearch::$helpSectionManager protected property The help section plugin manager.
HelpSearch::$languageManager protected property The language manager.
HelpSearch::$messenger protected property The messenger. Overrides MessengerTrait::$messenger
HelpSearch::$searchIndex protected property The search index.
HelpSearch::$searchSettings protected property A config object for 'search.settings'.
HelpSearch::$state protected property The state object.
HelpSearch::access public function Overrides AccessibleInterface::access
HelpSearch::create public static function Overrides PluginBase::create
HelpSearch::execute public function Overrides SearchInterface::execute
HelpSearch::indexClear public function Overrides SearchIndexingInterface::indexClear
HelpSearch::indexStatus public function Overrides SearchIndexingInterface::indexStatus
HelpSearch::markForReindex public function Overrides SearchIndexingInterface::markForReindex
HelpSearch::updateIndex public function Overrides SearchIndexingInterface::updateIndex
HelpSearch::__construct public function Constructs a \Drupal\help_search\Plugin\Search\HelpSearch object. Overrides PluginBase::__construct
MessengerTrait::messenger public function Gets the messenger. 26
MessengerTrait::setMessenger public function Sets the messenger.
PluginBase::$configuration protected property Configuration information passed into the plugin. 1
PluginBase::$pluginDefinition protected property The plugin implementation definition. 1
PluginBase::$pluginId protected property The plugin ID.
PluginBase::DERIVATIVE_SEPARATOR constant A string which is used to separate base plugin IDs from the derivative ID.
PluginBase::getBaseId public function Overrides DerivativeInspectionInterface::getBaseId
PluginBase::getDerivativeId public function Overrides DerivativeInspectionInterface::getDerivativeId
PluginBase::getPluginDefinition public function Overrides PluginInspectionInterface::getPluginDefinition 2
PluginBase::getPluginId public function Overrides PluginInspectionInterface::getPluginId
RefinableCacheableDependencyTrait::addCacheableDependency public function 1
RefinableCacheableDependencyTrait::addCacheContexts public function
RefinableCacheableDependencyTrait::addCacheTags public function
RefinableCacheableDependencyTrait::mergeCacheMaxAge public function
SearchPluginBase::$keywords protected property The keywords to use in a search.
SearchPluginBase::$searchAttributes protected property Array of attributes - usually from the request object.
SearchPluginBase::$searchParameters protected property Array of parameters from the query string from the request.
SearchPluginBase::buildResults public function Overrides SearchInterface::buildResults 1
SearchPluginBase::buildSearchUrlQuery public function Overrides SearchInterface::buildSearchUrlQuery 1
SearchPluginBase::getAttributes public function Overrides SearchInterface::getAttributes
SearchPluginBase::getHelp public function Overrides SearchInterface::getHelp 1
SearchPluginBase::getKeywords public function Overrides SearchInterface::getKeywords
SearchPluginBase::getParameters public function Overrides SearchInterface::getParameters
SearchPluginBase::isSearchExecutable public function Overrides SearchInterface::isSearchExecutable 2
SearchPluginBase::searchFormAlter public function Overrides SearchInterface::searchFormAlter 1
SearchPluginBase::setSearch public function Overrides SearchInterface::setSearch 1
SearchPluginBase::suggestedTitle public function Overrides SearchInterface::suggestedTitle
SearchPluginBase::usesAdminTheme public function Overrides SearchInterface::usesAdminTheme
StringTranslationTrait::$stringTranslation protected property The string translation service. 3
StringTranslationTrait::formatPlural protected function Formats a string containing a count of items.
StringTranslationTrait::getNumberOfPlurals protected function Returns the number of plurals supported by a given language.
StringTranslationTrait::getStringTranslation protected function Gets the string translation service.
StringTranslationTrait::setStringTranslation public function Sets the string translation service to use. 2
StringTranslationTrait::t protected function Translates a string to the current language or to a given language. 1

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