0

We use Sitecore and TDS, and I'm just getting into trying to do some refactoring taking advantage of Glass, and am trying to figure out if there's a way to take a Glass field (e.g. a Glass.Mapper.Sc.Field.Link) and cast/convert it to the underlying Sitecore LinkField (General Link) so I can use existing utility methods we have in place elsewhere that take a LinkField as a param (for example).

I've done some looking, but am not finding anything -- just trying to figure out if I need to create refactored versions of our utility methods to accept Glass objects, or if this is doable some other way. Thanks in advance if you can help.

wildwend
  • 573
  • 1
  • 5
  • 17

1 Answers1

3

At the moment their isn't a utility for this. Glass disconnects the data source (i.e. the item) from the final object. This is done to give greater flexibility. Instead you should right a custom data handler that will return a general link field, see information here: http://glass.lu/docs/tutorial/sitecore/tutorial19/tutorial19.html

It shouldn't take more than 20 lines of code to implement.

Michael Edwards
  • 6,308
  • 6
  • 44
  • 75