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.

what is the difference between implements Gdn_IPlugin and Gdn_Plugin

peregrineperegrine MVP
edited May 2012 in Vanilla 2.0 - 2.8

and when would you use one over the other?

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

Best Answer

  • ToddTodd Chief Product Officer Vanilla Staff
    Answer ✓

    Short answer

    You want to extend Gdn_Plugin 99% of the time.

    Longer answer

    This is a classical design pattern for interfaces. Basically, implements Gdn_IPlugin is the the interface you have to implement if you want to make a plugin. It has a few methods and properties that plugins need.

    You can implement that interface and make the methods yourself or you can extend Gdn_Plugin which has some default implementations.

    Usually, you extend Gdn_Plugin if you aren't already extending another class and you implement Gdn_IPlugin if you are extending another class, but you still want a plugin.

Answers

  • ToddTodd Chief Product Officer Vanilla Staff
    Answer ✓

    Short answer

    You want to extend Gdn_Plugin 99% of the time.

    Longer answer

    This is a classical design pattern for interfaces. Basically, implements Gdn_IPlugin is the the interface you have to implement if you want to make a plugin. It has a few methods and properties that plugins need.

    You can implement that interface and make the methods yourself or you can extend Gdn_Plugin which has some default implementations.

    Usually, you extend Gdn_Plugin if you aren't already extending another class and you implement Gdn_IPlugin if you are extending another class, but you still want a plugin.

  • Thanks ...

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

Sign In or Register to comment.