diff --git a/core/modules/search/search.api.php b/core/modules/search/search.api.php index 2b6be9a9b77ae87b7db56b605d2f8f3754228f66..8deb15c6f19e4451330de28050f7af213c2a4fbe 100644 --- a/core/modules/search/search.api.php +++ b/core/modules/search/search.api.php @@ -48,3 +48,19 @@ function hook_search_preprocess($text, $langcode = NULL) { return $text; } + +/** + * Alter search plugin definitions. + * + * @param array $definitions + * The array of search plugin definitions, keyed by plugin ID. + * + * @see \Drupal\search\Annotation\SearchPlugin + * @see \Drupal\search\SearchPluginManager + */ +function hook_search_plugin_alter(array &$definitions) { + if (isset($definitions['node_search'])) { + $definitions['node_search']['title'] = t('Nodes'); + } +} + diff --git a/core/modules/search/src/SearchPluginManager.php b/core/modules/search/src/SearchPluginManager.php index a7e22385a9fab23970a3d512bee0d1dd7a1d3f60..5670e714c7eee91597ea2212ffd9983c979cf58e 100644 --- a/core/modules/search/src/SearchPluginManager.php +++ b/core/modules/search/src/SearchPluginManager.php @@ -29,9 +29,7 @@ class SearchPluginManager extends DefaultPluginManager { */ public function __construct(\Traversable $namespaces, CacheBackendInterface $cache_backend, ModuleHandlerInterface $module_handler) { parent::__construct('Plugin/Search', $namespaces, $module_handler, 'Drupal\search\Annotation\SearchPlugin'); - $this->setCacheBackend($cache_backend, 'search_plugins'); - // @todo Set an alter hook. + $this->alterInfo('search_plugin'); } - }