C# Class Sitecore.SharedSource.Commons.Utilities.SitecoreLinkUtil

Utilities for retrieving URLs to various things in Sitecore.
Exibir arquivo Open project: Velir/Sitecore-Commons

Public Methods

Method Description
GetDeviceUrlForItem ( System.Item item, DeviceItem device ) : string

Return the Url for for a specified item to show a certain device. If successful this method will return the url to the item with the proper device url parameter appended. If not successful return an empty string.

GetDeviceUrlForItem ( System.Item item, DeviceItem device, UrlOptions urlOptions ) : string

Returns the url for a specified item and a specific device. UrlOptions will be used if they are provided, but are not required. If successful, a url for the item will be returned. If not successfully, an empty string will be returned.

GetFullMediaUrl ( Database db, MediaItem image ) : string

Returns the URL for a media library item. This will return an empty string if there are problems with the image, or if the media id points to a non existant image. This method should be used instead of the src for an image field. That src field is not guaranteed to be updated if the media item moves, by using this method, even if the item moves, the URL will be correct.

GetMediaSrc ( Database db, MediaItem mediaItem ) : string

Gets the media source for a media item in the specified database. The path will come out in the following form ~/media/{MEDIA PATH}.{MEDIA EXTENSION}

Method Details

GetDeviceUrlForItem() public static method

Return the Url for for a specified item to show a certain device. If successful this method will return the url to the item with the proper device url parameter appended. If not successful return an empty string.
public static GetDeviceUrlForItem ( System.Item item, DeviceItem device ) : string
item System.Item The item.
device DeviceItem The device.
return string

GetDeviceUrlForItem() public static method

Returns the url for a specified item and a specific device. UrlOptions will be used if they are provided, but are not required. If successful, a url for the item will be returned. If not successfully, an empty string will be returned.
public static GetDeviceUrlForItem ( System.Item item, DeviceItem device, UrlOptions urlOptions ) : string
item System.Item The item to get the url for.
device DeviceItem [optional] The device for the url.
urlOptions UrlOptions [optional] The url parameters for the url.
return string

GetFullMediaUrl() public static method

Returns the URL for a media library item. This will return an empty string if there are problems with the image, or if the media id points to a non existant image. This method should be used instead of the src for an image field. That src field is not guaranteed to be updated if the media item moves, by using this method, even if the item moves, the URL will be correct.
public static GetFullMediaUrl ( Database db, MediaItem image ) : string
db Database The Sitecore db.
image MediaItem The image custom item.
return string

GetMediaSrc() public static method

Gets the media source for a media item in the specified database. The path will come out in the following form ~/media/{MEDIA PATH}.{MEDIA EXTENSION}
public static GetMediaSrc ( Database db, MediaItem mediaItem ) : string
db Database The sitecore database where the media item lives.
mediaItem MediaItem The media item to look for.
return string