¡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_helpful_box_plugin_context
The on_helpful_box_plugin_context
hook allows plugins to provide dynamic context to the helpful box feature.
This is particularly useful for associating plugin-specific content, such as articles or pages, with feedback tracking mechanisms.
$hookResults = DynamicHooks::executeHook('on_helpful_box_plugin_context', false, [
'page_id' => $page_id,
'news_article_id' => $news_article_id,
], $jakdb, $jkv, $lang);
foreach ($hookResults as $namespace => $context) {
if (isset($context['plugin_id']) && isset($context['plugin_item_id'])) {
$plugin_id = $context['plugin_id'];
$plugin_item_id = $context['plugin_item_id'];
break; // Stop if valid plugin context is found
}
}
This hook aggregates plugin-specific context and allows the helpful box to function dynamically for different types of content.
$yourPluginId = $this->db->get('plugins', 'id', ['name' => 'Your_Plugin_Name']);
DynamicHooks::addHook('on_helpful_box_plugin_context', function($context) use ($plugin, $yourPluginId) {
if (isset($context['page_id'])) {
return [
'plugin_id' => $yourPluginId,
'plugin_item_id' => $plugin['id'] ?? null
];
}
return null;
}, 'your_plugin');
plugin_id
and plugin_item_id
values.$context
array for missing or invalid values.