c# - Sitecore Droplist with Multiple Sources -
i have data template has droplist field. want data source come 2 sitecore folder items.
is there anyway define multiple sources droplist?
not in standard drop list field, shouldn't difficult create custom sitecore field based on droplist takes 2 parameters source field.
this resource creating custom controls: http://sitecorejunkie.com/2012/12/28/have-a-field-day-with-custom-sitecore-fields/
the droplist control uses sitecore.shell.applications.contenteditor.valuelookupex control. create new control inherited , override getitems() method read items source
the current 1 looks this:
protected override item[] getitems(item current) { assert.argumentnotnull((object) current, "current"); using (new languageswitcher(this.itemlanguage)) return lookupsources.getitems(current, this.source); }
so make source have 2 guids/paths split pipe (|)
protected virtual item[] getitems(item current) { assert.argumentnotnull((object) current, "current"); using (new languageswitcher(this.itemlanguage)) { var sourcelist = this.source.split('|'); var items = lookupsources.getitems(current, source[0]).tolist(); items.addrange(lookupsources.getitems(current, source[1])); return items.toarray(); } }
- disclaimer - code untested, should point in right direction.
Comments
Post a Comment