How to make the linked object editable in droppable collective.cover tiles

By default, collective.cover offers one mechanism to "drop" objects to their tiles, by using the "Add content" button at the top. I've received feedback that the button will not be very friendly to editors, so my solution, in this case, is really simple.

In the tile schema, instead of the default:

    uuid = schema.TextLine(
        title=_(u'UUID'),
        required=False,
        readonly=True,
    )

redefine uuid to be such as:

from plone.formwidget.contenttree import UUIDSourceBinder
from z3c.relationfield.schema import RelationChoice

class IMyTile(IPersistentCoverTile):
    uuid = RelationChoice(
        title=u"Linked object",
        source=UUIDSourceBinder(),
        required=False,
    )
This simple change should make the uuid editable with the default contenttree widget.

Comments