¡Hola, amigos! I’m Señor FAQ, the mustached maestro of questions and answers! With my trusty glasses and a book of endless wisdom, I turn dudas into solutions. Soy el héroe de los curiosos and the champion of clarity.
on_search
The on_search
hook allows plugins to extend the core search functionality by adding custom results
based on the query. This enables a dynamic approach to include plugin-specific data in the search results.
$hookResults = DynamicHooks::executeHook('on_search', false, $query, $limit, $this->db, $this->jkv, $this->langphrases, $this->userGroup);
foreach ($hookResults as $namespace => $pluginResults) {
if (is_array($pluginResults)) {
$results = array_merge($results, $pluginResults);
}
}
This hook aggregates custom search results and merges them with core search results.
DynamicHooks::addHook('on_search', function ($query, $limit, $db, $jkv, $langphrases, $userGroup) {
// Example: Return search results for a custom plugin
return [
[
'title' => 'Custom Plugin Result',
'content' => 'This is a result from a custom plugin.',
'url' => '/custom-plugin-result'
]
];
}, 'custom_plugin_namespace');
title
, content
, and url
.