CustomReferenceField(
            "relatedItems",
            relationship="relatesTo",
            multiValued=True,
            isMetadata=True,
            languageIndependent=False,
            index="KeywordIndex",
            referencesSortable=True,
            # required=True,
            widget=ReferenceBrowserWidget(
                allow_search=True,
                allow_browse=True,
                allow_sorting=True,
                show_indexes=False,
                force_close_on_insert=True,
                label=_(u"label_related_items", default=u"Related Items"),
                description="",
                visible={"edit": "visible", "view": "invisible"},
            ),
        )
    )
)

# Set storage on fields copied from ATFolderSchema, making sure
# they work well with the python bridge properties.

ScoreboardVisualizationSchema["title"].storage = atapi.AnnotationStorage()
ScoreboardVisualizationSchema["description"].storage = atapi.AnnotationStorage()

schemata.finalizeATCTSchema(ScoreboardVisualizationSchema, folderish=False, moveDiscussion=False)
ScoreboardVisualizationSchema.changeSchemataForField("relatedItems", "default")
        if set(old) != set(value):
            notify(VisualizationEnabledEvent(instance, cleanup=False))

ScoreboardVisualizationSchema = folder.ATFolderSchema.copy() + atapi.Schema((
    CustomReferenceField('relatedItems',
        relationship='relatesTo',
        multiValued=True,
        isMetadata=True,
        languageIndependent=False,
        index='KeywordIndex',
        referencesSortable=True,
        #required=True,
        vocabulary_factory=u'scoreboard.visualization.vocabulary.DataCube',
        widget=atapi.SelectionWidget(
            format=u'select',
            label=_(u'Data source'),
            description='',
            visible={'edit': 'visible', 'view': 'invisible'}
            )
        ),
    atapi.ImageField(
        'thumbnail',
        schemata="default",
        required=False,
        languageIndependent=True,
        widget=atapi.ImageWidget(
            label=_(u"Thumbnail"),
        )
    ),
))