Skip to content

Commit

Permalink
+ This is a little feature of mine that I used to debug stuff months …
Browse files Browse the repository at this point in the history
…ago, and I figured it might be helpful to plugin authors as well, so let's do this... You can get a 'debug' view of hooks at templating time if you're an admin and you manually add ";viewhooks" to the URL (or "?viewhooks" if there's no question mark to begin with.) A red box means it's unused, and of course a green box means that at least one plugin is using that hook. Stick your mouse pointer over any box to get a tooltip indicating the hook's name. That's all, folks! (Subs.php)
  • Loading branch information
Nao committed Oct 21, 2014
1 parent f7822f7 commit 15bb50b
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions core/app/Subs.php
Expand Up @@ -2389,6 +2389,9 @@ function call_hook($hook, $parameters = array(), $plugin_id = '')
{
global $settings;

if (isset($_GET['viewhooks']) && we::$is_admin)
echo '<div style="display: inline-block; background: ', empty($settings['hooks'][$hook]) ? 'red' : 'green', '; border: 1px solid white; border-radius: 2px; width: 8px; height: 8px" title="', westr::safe($hook), '"></div>';

if (wetem::$hooks && wetem::$hooks->has($hook))
wetem::$hooks->render($hook);

Expand Down

0 comments on commit 15bb50b

Please sign in to comment.