Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

Is the AssetModel_StyleCss_Handler hook working?

edited January 2013 in Vanilla 2.0 - 2.8

I have written a plugin that is attempting to add its own CSS file to the page. It does so using this hook:

class LocaleSelectorPlugin extends Gdn_Plugin {
    public function AssetModel_StyleCss_Handler($Sender) {
        $Sender->AddCssFile('localeselector.css', 'plugins/LocaleSelector');

I'm finding the CSS is not being added. In fact, it does not look like this handler is being executed at all, since I can add a die("test") into it, and that does not stop the page from rendering.

I'm using Vanilla Is there something really obvious I am missing? The remainder of the plugin is working fine.

-- Jason


  • KasperKasper Scholar of the Bits Copenhagen Vanilla Staff
    edited January 2013

    AssetModel_StyleCss_Handler was implemented in 2.1 and as such is not available in 2.0

    Kasper Kronborg Isager (kasperisager) | Freelance Developer @Vanilla | Hit me up: Google Mail or Vanilla Mail | Find me on GitHub

  • Ah, when I couldn't find the Asset Model, I thought something was amiss. I guess this is a Vanilla 2.1 thing only.

    I have added the above code to the Before_Render_Handler() method of my plugin, and that does work.

  • @kasperisager said:
    AssetModel_StyleCss_Handler was implemented in 2.1 and as such is not available in 2.0

    The confusing thing is looking at the examples of some of the modules from git. Not all of them have a version dependency set, so it is not clear that they only work from a certain Vanilla version. Most do though, so it is worth looking at that before digging through code for examples.

  • peregrineperegrine MVP
    edited January 2013

    Any of the plugins updated by the vanilla designers and updated since last Spring, may have not been backported to in some cases, and probably use new methods, etc not available in in

    a bit of the reverse :) - was hoping folks would add to it. But you know how that goes :).

    BTW - the first plugin code I ever looked at or used as a user on a forum was your reply-to plugin. :)

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • Cool :-) I expect it will need some TLC with Vanilla 2.1 It is not something I have time for at the moment, but would welcome pull requests (I think I put it on GitHub a while ago - if not, kick me into action).

    I noticed also, shortly after ReplyTo that the core Vanilla gained hierarchical categories using the same technique made popular by Joe Celko. It would be nice if the nested set technique were pulled out of the categories and turned into a more generic library that could be used by ReplyTo, the core and other plugins. Just putting the idea out there... ;-)

    I haven't touched Vanilla for a while, until I got a call before Christmas by a client to do some custom work. It is resulting in some multi-lingual plugins that I think would be really useful to the community, and I will try to get them released. They are for Vanilla 2.0.18 only, so if published, we could work on making them 2.1 compatible (I'm sure the client will ultimately see the value of that).

    -- Jason

Sign In or Register to comment.