Vanilla 1 is no longer supported or maintained. If you need a copy, you can get it here.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

EventForm clone of DiscussionForm

I'm thinking of extending DiscussionForm with all the Event related form elements.
I can start by
class EventForm extends DiscussionForm
and then write my own event_discussion_form.php file

However, how will i tell vanilla if an event is being added then it should use my version of discussion_form and not the default one.
Plus is this even a good idea, or should i resort to delegations.

Comments

  • You can use the object factory to override the vanilla classes with your own. You have to set a new class reference but I've never seen a live example of this done. Also note the limitations listed in the section below that.
  • edited October 2007
    Discussion overview actually does this. he (jazzman) references the DiscussionGrid class with his own class. he doesn't however, extend or overwrite the DiscussionGrid class.

    Now if i extend the DiscussionForm, and don't overwrite its functions. this way i won't break any extensions that rely on DiscussionForm class.
    any thoughts before i attempt to do this.

    Btw DiscussionForm should have functions of SaveDiscussion, SaveComment, Reply, etc right now it does everything in the constructor. If I now want to extend SaveDiscussion part of the constructor, I cannot. Something like this would be better
    if ($this->PostBackAction == 'SaveDiscussion') { $this->SaveDiscussion(); } else if ($this->PostBackAction == 'SaveComment') { $this->SaveComment(); } else if ($this->PostBackAction == 'Reply') { $this->Reply(); }
  • MarkMark Vanilla Staff
    Can't you just access the SaveDiscussion/Comment/Reply in the methods themselves? Use delegates within? If they don't exist, you can always ask for new delegates.
  • edited October 2007
    One more thing what should be type of EventRolePermission field in the database. Should it be a comma separated field like 3,4 which means Moderators and admins, or is their a better way.
This discussion has been closed.