Commit 3d06929d authored by catch's avatar catch

Issue #2087965 by AndyThornton, neclimdul, tim.plunkett, jhodgdon, pwolanin:...

Issue #2087965 by AndyThornton, neclimdul, tim.plunkett, jhodgdon, pwolanin: Fixed The SearchPluginManager needs to provide an alter hook for its discovery.
parent 6a3574ac
......@@ -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');
}
}
......@@ -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');
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment