Throughout my project I often use the Sitecore General Link field for links (external or internal or media). One standard I have is that for all of my pages there is a field on every page called "NavigationTitle". It allows the CMS author to control the display of the text for the item whenever that item is linked to. Ideally I would like to be able to find some way of having the system use that field from the target item whenever that item is linked to. Here is an example.
Let's say that all of the pages in my site have the following basic fields
- NavigationTitle (text)
- Content (rich text)
And let's say I have a data template called Promo. And Promo has the following fields:
- Title (text)
- Content (text)
- Image (image)
- Link (general link)
The Link field on a Promo could link to an internal page or even an external page. Right now when I build the sublayout to display a Promo, if I use a <sc:Link>
tag to output the Link field I believe that Sitecore will first use the Text of the Link field for the text. Otherwise I think it will use the Item Name for the text.
I would like to build it so that instead of using the Item Name of the target item, I would like to use a particular field value from the target item. And I would like to have this code run at a low enough level so that this would work in conjunction with something like Glass Mapper. So that when I use Glass Mapper to output the Link field (using something like the Editable method) that it would display the correct link text.
Does anyone know how I would do this? I'm guessing that I might have to create a custom General Link Field that inherits from the normal General Link Field and overrides something. Just a guess. Any help is appreciated.