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.

How can I change a module without editing the core?

whu606whu606 I'm not a SuperHero; I just like wearing tights... MVP
edited July 2012 in Vanilla 2.0 - 2.8

I would like to change the asset target in

class.categoriesmodule

found in applications/vanilla/modules

I've tried copying over the modules folder to my theme folder, and I've tried putting the edited file in about every place in my theme I can think of, to no avail.

The change works fine when I edit the original file, but obviously that isn't ideal.

Am I going about this all wrong, or just missing something obvious?

Thanks.

Comments

  • whu606whu606 I'm not a SuperHero; I just like wearing tights... MVP

    I'll try one gentle nudge with this, now that the working week has started...

  • ToddTodd Chief Product Officer Vanilla Staff

    This isn't an easy thing to do right now unfortunately. Two methods I can think of.

    1. Switch the asset target in an event handler.
    public function Base_Render_Before($Sender, $Args) {
        if (isset(Gdn::Controller()->Assets['Panel']['CategoriesModule'])) {
             unset(Gdn::Controller()->Assets['Panel']['CategoriesModule']);
             Gdn::Controller()->AddModule('CategoriesModule', 'Content');
          }
    }
    
    1. Just include the categories module manually in a theme. First disable the categories module in dashboard/categories. Then add the following to your default.master.tpl:
    {module name="CategoriesModule"}
    
  • peregrineperegrine MVP
    edited July 2012

    Since nobody has bitten - a wild guess to modify it to content in the

    maybe use this event in theme hooks or a plugin.

      $this->FireEvent('BeforeAddModule');
    
     $this->AddModule('CategoryControllerModule', 'Content');
    

    or somebody will correct the above.

    edited: While I was posting somebody had bitten.

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

  • whu606whu606 I'm not a SuperHero; I just like wearing tights... MVP

    Thanks @Todd and @peregrine

    I shall have a play with those.

  • whu606whu606 I'm not a SuperHero; I just like wearing tights... MVP

    @Todd

    Brilliant, as always!

    That first suggestion worked like a charm.

    Thanks again for the help.

    @Peregrine - thanks for being prepared to 'have a go'!

Sign In or Register to comment.