I've created custom treeview field - multiselect treeview.
This field inherited from Sitecore.Shell.Applications.ContentEditor.TreeList with overridden method Add():
public class MultiselectTreeList : TreeList
{
protected new virtual void Add()
{
bool alert = true;
if (this.Disabled) return;
string viewStateString = this.GetViewStateString("ID");
var treeviewEx = this.FindControl(viewStateString + "_all") as TreeviewEx;
Assert.IsNotNull(treeviewEx, typeof (DataTreeview));
var listbox = this.FindControl(viewStateString + "_selected") as Listbox;
Assert.IsNotNull(listbox, typeof (Listbox));
if (treeviewEx == null)
{
SheerResponse.Alert("TreeviewEx control not found..", new string[0]);
}
else
{
Item[] selectionItems = treeviewEx.GetSelectedItems();
if (selectionItems == null)
{
SheerResponse.Alert("Select an item in the Content Tree.", new string[0]);
}
else
{
foreach (Item selectionItem in selectionItems)
{
if (this.HasExcludeTemplateForSelection(selectionItem)) return;
if (this.IsDeniedMultipleSelection(selectionItem, listbox))
{
if (alert)
{
SheerResponse.Alert("You cannot select the same item twice.", new string[0]);
alert = false;
}
}
else
{
if (!this.HasIncludeTemplateForSelection(selectionItem)) return;
SheerResponse.Eval("scForm.browser.getControl('" + viewStateString +
"_selected').selectedIndex=-1");
var listItem = new ListItem {ID = GetUniqueID("L")};
Sitecore.Context.ClientPage.AddControl(listbox, listItem);
listItem.Header = this.GetHeaderValue(selectionItem);
listItem.Value = listItem.ID + (object) "|" + selectionItem.ID;
SheerResponse.Refresh(listbox);
SetModified();
}
}
}
}
}
}
I've registered it in core database: /sitecore/system/Field types/Custom Types/Multiselect Tree List: filled Assembly and Class fields.
Added item with multiselect treelist field. Filled data. Multiple selection works OK.
But when I try to find References using Ribbon->Navigate->Links I don't see references to items (also missed TargetItemId in Links table in master Database).
When I changed it to Sitecore Treeview field - everything works fine.
As far as I understood crawler don't index my field and links not added to database.
Any ideas how to fix this?