Creating Content Part without Content Item

Topics: General, Writing modules
Jun 8, 2013 at 4:53 AM

I am trying to build a reusable Contact Us feature. I don't want to store anything into database, just send out an email. Also, I want the feature to appear just under Content Part listing. Don't want it to appear anywhere else in admin interface.

What I am trying to do to achieve this?
I have created a module, defined Driver and Views (Editor and Display). I believe ContentPartRecord and Handler are not required as I don't want to store anything in database.

But still couldn't make it working, continue investigating further.

Meanwhile, if you have done this before OR have an idea on how this can be done, please share with me.

Thanks in advance,
Jun 8, 2013 at 10:00 AM
If you create a content part, it will need at least a driver so that your content part class gets welded on to the content types it is attached to (strictly speaking there are other ways, but this is the easiest way). Also, you will need a driver with a Display implementation to create a shape that renders your contact form.
You'll also need a Controller to which the form gets submitted and from where you will send an email.

That being said, if you are OK with the fact that the Custom Forms feature does all these things already (and is very flexible) except that it saves submitted forms (but removes them if you do not tick the "Save the content item once the form is submitted" checkbox), you don't have to write any module yourself.
Jun 8, 2013 at 10:29 AM
Hi Sfmskywalker,

Thank you.
I did not know of Custom Forms. I will now play with it and will first try building Contact Us form using that.