Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Use query for the source of a General Link field

Tags:

sitecore

Is it possible to modify the General Link field in Sitecore to enable queries to be used in the 'Source' in the template field definition? I'm hoping that it might be possible to add a pipeline processor to handle queries for the General Link field in a similar way that this article describes enabling queries for Treelists and Datasources.

like image 574
Matthew Dresser Avatar asked Aug 04 '15 13:08

Matthew Dresser


1 Answers

Unfortunately it's not possible with a pipeline since the source resolution does not happen with a pipeline like it does with DropLink field for example.

You can set an absolute path and that works fine... In order to make the source queryable you would have to inherit Sitecore.Shell.Applications.ContentEditor.Link and override the Source property to resolve the query, resolving the query in pretty much the same way you have linked to.

The current implementation does a simple GetItem:

Item obj = Client.ContentDatabase.GetItem(this.Source);

Whereas we need a item.Axes.SelectSingleItem() type query. Unfortunately that means a custom field type or updating the current field type in the core database.

like image 131
jammykam Avatar answered Oct 28 '22 14:10

jammykam