- π³πΏNew Zealand quietone
I think requires too many changes to be a novice level issue.
I also question if this should be done because of the progress in π Hux-style hooks, proof of concept Needs work .
I was told on #2087965: The SearchPluginManager needs to provide an alter hook for its discovery β that this plugin documentation header provides sufficient information for someone who wants to implement the hook, and that it is the standard way to document plugin alter hooks:
/**
* 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');
}
}
Apparently, the main reason that someone would want to use one of these plugin hooks is to substitute their own class for one of the Core (or other module) plugins. It was not obvious to me how you would do this, from this documentation header.
I think it should be made more obvious. Specifically:
a) The sample function body should illustrate the usual reason someone would want to alter the plugin definition, not an atypical case like altering the title.
b) The @param should explain where to find documentation about what the "array of search plugin definitions" is (what each search definition is, which is an array of objects? arrays? who knows).
And this needs to be done for all of the plugin alter hooks, not just Search, because apparently this is the typical documentation being used for all the plugins.
Active
11.0 π₯
Not all content is available!
It's likely this issue predates Contrib.social: some issue and comment data are missing.
I think requires too many changes to be a novice level issue.
I also question if this should be done because of the progress in π Hux-style hooks, proof of concept Needs work .