I am using a Custom Field Type called QueryableTreelist which is extended from built-in Treelist field type. When an item is added to this queryabletreelist field, the linked item do not show the link in Sitecore -> Navigate-> Links in the Sitecore Ribbon. I have rebuilt the link databases many times. I have added the Custom Field Type in the FieldTypes.config file via patching. And it is showing up in Showconfig.aspx also.
I have also noticed that if I use the built-in FieldType TreeList, then it works fine and updates the Link database.
The code for the QueryableTreelist is as follows:
public class QueryableTreeList : TreeList
{
public new string Source
{
get
{
return base.Source;
}
set
{
if (!value.StartsWith("query:"))
{
base.Source = value;
}
else
{
string valueNoParameters = value;
string parameters = string.Empty;
if (valueNoParameters.Contains("&"))
{
valueNoParameters = value.Remove(value.IndexOf("&", System.StringComparison.Ordinal));
parameters = value.Substring(value.IndexOf("&", System.StringComparison.Ordinal));
}
Item item = Sitecore.Context.ContentDatabase.Items[this.ItemID];
if (item != null)
{
try
{
Item itemQueried = item.Axes.SelectSingleItem(valueNoParameters.Substring("query:".Length));
if (itemQueried != null)
{
base.Source = "datasource=" + itemQueried.Paths.FullPath + parameters;
}
else
{
base.Source = string.Empty;
}
}
catch (Exception e)
{
Sitecore.Diagnostics.Log.Warn("QueryableTreeList.cs failed to run source query", e, this);
base.Source = string.Empty;
}
}
}
}
}
}
I am using Sitecore 8.2 Update 2.
Thanks