• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Template hook doesn't work

Arty

Well-known member
#1
I'm trying to append css at the end of xenforo.css template. I've created event listener for it and put this simple code for test:
Code:
    public static function templateHook($hookName, &$contents, array $hookParams, XenForo_Template_Abstract $template)
    {
        switch($hookName)
        {
            case 'xenforo_css_extra':
                $contents .= 'test { whatever } ';
                break;
            case 'body':
                $contents .= 'This is a test!';
                break;
        }
    }
For some reason hook for "xenforo_css_extra" never gets called.

Hook for "body" does work correctly, so event listener is working. I'm testing it with default style that has <xen:hook name="xenforo_css_extra" /> at last line of xenforo.css
 

xfrocks

Well-known member
#4
This is not the same problem. CSS script (css.php) doesn't call dependencies class so plugins simply don't work when CSS is generated.