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.

Changes to event architecture in Vanilla

edited February 2011 in Vanilla 2.0 - 2.8
That I want to see is reorganizing code from

$this->FireEvent('PrimerEvent'); Do something


$this->FireEvent('PrimerEvent'); if ($this->$HandleBehaviour != SKIP_ORIGINAL ) { Do something }

So we could replace original parts between events using only event handlers by allowing them to set skip flags.


  • Options
    ToddTodd Chief Product Officer Vanilla Staff
    It's probably a little late at this point to put this into every event handling. Where appropriate I've used the event arguments to do something similar to this, but it's on a case-by-case basis.
  • Options
    Looking through editor find function we have 182 entrances only.
    So, it looks pretty on time :-)
    Especially in the views part.
    Making elegant changes to some output parts improve compatibility with future version.
    And it'll be compatible with all current code.
    This is my understanding.
  • Options
    LincLinc Detroit Admin
    Why don't you override the method or function it's in instead? Doing something like DiscussionController_Index_Create in a plugin overrides the Index method in DiscussionController.

    If it's in a view, you can also easily override with a theme.
  • Options
    edited February 2011
    I think that you don't get me.
    Today I must replace whole PHP file in view folder just to change some flow and design.
    And, making every view to be sequence of events and areas in between, that can be skipped, allow me to write simple and plain plugin that replaced only small part retaining very good compatibility with all future changes.
  • Options
    LincLinc Detroit Admin
    edited February 2011
    If you need to replace an entire View because you need to omit some logic, you can do that with a Theme rather than replacing it in core. It's (part of) what themes are for. If you need to skip an entire section of a method in a controller or model, then you can override it with a plugin using the method I described above.

    I wasn't suggesting it wouldn't be more convenient for you to have a 'skip' flag, I'm just explaining how to do what you need without making core modifications to Vanilla.
  • Options
    LincLinc Detroit Admin
    In this case, I'd say I prefer @Todd's approach of doing it on a case-by-case basis because it seems to me that sprinkling extra logic structures throughout the code base isn't ideal. If there's a particular place you want this sort of thing added to support your app or plugin, let us know and we'll have a look. :)
  • Options
    I'll try to make a separate fork with such functionality in this case.
    Well see how it goes.
Sign In or Register to comment.