Custom Event type with a registration form?

I would like to create a custom Event type with an optional registration form.
This is to avoid creating an ad-hoc easyform each time a registration form is required.

I noticed a bunch of event behaviors that could augment custom types.
For example I was thinking about a custom Folder type with event behavior(s)
to include a generic registration form made using easyform.
Or maybe a registration form could be made into a behavior to augment a custom Event type?

Any suggestions?

You could create a generic EasyForm with a field would be used as a reference for the related event. From individual events you can link to this particular form an pass the id of the event through an url parameter to the registration forms..more interesting question: where would you store registrations and how would you process them?

Have a look at this easyform plugin to handle registrations

Some brainstorming

  1. You could add a behavior to Event type (or add a new type). This event would let you select a related EasyForm. Then a viewlet would show the form. (Maybe with pat-inject… the approach I use for 'similar stuff'). You will need to modify the "saving of registration" so it saves to "your folder" or maybe use a content rule based on "from what context it was called" ?
    The upside is that it is easy to edit the Easyform when you need to make changes.

  2. You could make a vielet that is registered for a behavior / and "some_field" is enabled. The viewlet shows the form.

  3. You could just change the event type to folderish and make an event rule that copies an easy form "into it" every time you add an event. (and then a viewlet or another browser view to show it

UPDATE: For the users, it might be more 'slick' if you use pat content load to load/show the registration, then you just use a button to load the registration form (like this )

@espenmn, I like option 3.

  • How to change the event type to folderish?
  • How to create a pre-configured easyform to copy into the folderish event type?
  • How to use "pat content load"?

I think this can be done TTW by going to http://yourserver/Plone/portal_types/Folder/manage_propertiesForm

and change "Content type class" to

A (probably safer) alternative is to do this in an add-on, so you can replicate what you cid

Just make a standard easyform with all the settings you need (dont publish it). Then you need to program a little.

Your code should look something like:


Then, in your file "", (which you have to make), you need to define 'copyEasyForm" and add code to 'copy the form you made', it will be something like

def copyEasyForm(self, context):
    """copy some stuff"""
    plone.api.content.copy(source='my_easyform', target=self)

Please read: (since you need to 'find the source document, too' )


You can use for= to the Event content type instead of 'behaviours' if you prefer that (and dont want to make a behavior"

1 Like

Thanks a lot!

One issue: when changing the Event type to folderish, it does not turn existing event objects into folderish objects, only the new objects are folderish... does it means I'd have to re-import all events (using transmogrifier)?

<div id="content-target">
<button type="button" class="btn btn-primary pat-contentloader"
        <span>Click me</span>

the url syntax might be incorrect. (hard-code it until you get it working)

This is useful, thanks!

Because I want the handler to be called when an Event is created, I used
but it does not seem to work; my copyEasyForm handler contains only a logging call to display the event in the debugging console, and nothing shows.

Any idea how to configure the subscriber?

Also, I added it to the configure.zcml file of my policy package; is it an appropriate place to add it?

Try registering it for something more generic and see if that works
Maybe you can try: for="*"

If it still does not work: where did you put this code ( in configure.zcml ? ) . Did you stop and start you plone site ?

Still nothing shows. Here's what I tried.

In the configure.zcml file (of my policy package):

for="* zope.lifecycleevent.interfaces.IObjectAddedEvent"

In (of my policy package):

def modifiedContent(obj, event):
    """Event object was modified, cloned or created."""'added event {}, {}'.format(obj, event))

Could it be that the ObjectAddedEvent is actually for the folder (event was added to the folder) and you should use something else ( `zope.lifecycleevent.interfaces.IObjectCreatedEvent ? )

@espenmn: still no luck with IObjectCreatedEvent

Do you (need to) provide a marker interface?

I have this setup working for a behavior:

    <include package="plone.behavior" file="meta.zcml"/>

    <!-- -*- extra stuff goes here -*- -->

        title="Related Teaser Image Behavior"
        description="A related image field which displays like a leadimage"



class RelatedTeaserImage(object):

    def __init__(self, context):
        self.context = context

    def related_image(self):
        if hasattr(self.context, 'related_image'):
            return self.context.related_image
        return None

    def image_caption(self):
        if hasattr(self.context, 'image_caption'):
            return self.context.image_caption
        return None

    def related_image(self, value):
        self.context.related_image = value

    def image_caption(self, value):
        self.context.image_caption = value

    def image(self):
        image_link = getattr(self.context.aq_explicit, 'related_image', False)
        linked_image = image_link and self.context.related_image.to_object.image or ''
        return linked_image

def addILeadImageInterface(context, event):
    context = context.aq_explicit
    has_image = getattr(context, 'related_image', False)

    if has_image and not ILeadImage.providedBy(context):
        alsoProvides(context, ILeadImage)
    elif not has_image:
        noLongerProvides(context, ILeadImage)

Everything I tried failed miserably, as if the "subscriber" tag in my configure.zcml file is simply ignored. Is there a way to list subscribed handlers? How to debug?

As the first argument of a subscriber, is it valid to provide a schema (based on plone.supermodel.model.Schema)?

Here's another test:

    for=" zope.lifecycleevent.interfaces.IObjectCreatedEvent"

I was expecting my handler to fire at the creation of a new folder...

Plone Foundation Code of Conduct