Hook: on_tags
avatar
Señor FAQ

¡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.


Hook: on_tags

The on_tags hook allows plugins to contribute additional results based on tags.

Usage


$hookResults = DynamicHooks::executeHook('on_tags', false, $tag, $limit, $this->db, $this->jkv, $this->langphrases);

foreach ($hookResults as $namespace => $pluginResults) {
    if (is_array($pluginResults)) {
        $results = array_merge($results, $pluginResults);
    }
}
    

This hook dynamically extends tagged content by including plugin-specific results.

Example Implementation


DynamicHooks::addHook('on_tags', function ($tag, $limit, $db, $jkv, $langphrases) {
    // Example: Return results for a custom plugin
    return [
        [
            'title' => 'Custom Plugin Tagged Result',
            'content' => 'This is a result related to the tag.',
            'url' => '/custom-tagged-result'
        ]
    ];
}, 'custom_plugin_namespace');
    

Best Practices

  • Ensure returned results include essential properties like title, content, and url.
  • Use unique namespaces to avoid conflicts with other plugins.
  • Test custom tag results to ensure seamless integration.

Troubleshooting

  • Verify the hook is correctly registered under the intended namespace.
  • Check for missing or invalid result properties.
  • Inspect logs for errors during hook execution.
Was this article helpful?
0 out of 0 found this helpful