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

Utilities for dealing with presentation settings in Sitecore.
Show file Open project: Velir/Sitecore-Commons

Public Methods

Method Description
GetDeviceDefinition ( Item theItem, DeviceItem device ) : DeviceDefinition

Gets the device definition for a given item and device.

GetPlaceholderKeyName ( System.Web.UI.UserControl sublayout ) : string

Gets the name of the placeholder key that the passed in sublayout is bound to. This will return an empty string if for some reason we cannot get the placeholder name. You would use this from the code behind of a sublayout. So for example if I had a sublayout sltList and I wanted to know what placeholder it was bound to I would have something this in the code behind "string plcKeyName = PresentationUtil.GetPlaceholderKeyName(this);"

ItemHasPresentationSettingsForDevice ( Item theItem, DeviceItem device ) : bool

Checks to see if an item has presentation settings for the passed in device

ItemHasPresentationSettingsForLayout ( Item theItem, DeviceItem device, LayoutItem layoutItem ) : bool

Checks to see if the passed in item has presentation settings for the provided device and layout.

ItemHasPresentationSettingsForSublayout ( Item theItem, DeviceItem device, SublayoutItem sublayoutItem ) : bool

Checks to see if the passed in item has presentation settings for the provided device and sublayout.

TemplateHasPresentationSetDirectlyOnTemplate ( TemplateItem template ) : bool

Checks whether the presenation settings are set directly on a template, this should ususally be set on the standard values.

Method Details

GetDeviceDefinition() public static method

Gets the device definition for a given item and device.
public static GetDeviceDefinition ( Item theItem, DeviceItem device ) : DeviceDefinition
theItem Item The item.
device DeviceItem The device.
return DeviceDefinition

GetPlaceholderKeyName() public static method

Gets the name of the placeholder key that the passed in sublayout is bound to. This will return an empty string if for some reason we cannot get the placeholder name. You would use this from the code behind of a sublayout. So for example if I had a sublayout sltList and I wanted to know what placeholder it was bound to I would have something this in the code behind "string plcKeyName = PresentationUtil.GetPlaceholderKeyName(this);"
public static GetPlaceholderKeyName ( System.Web.UI.UserControl sublayout ) : string
sublayout System.Web.UI.UserControl The sublayout.
return string

ItemHasPresentationSettingsForDevice() public static method

Checks to see if an item has presentation settings for the passed in device
public static ItemHasPresentationSettingsForDevice ( Item theItem, DeviceItem device ) : bool
theItem Item The item to check.
device DeviceItem The device to check for.
return bool

ItemHasPresentationSettingsForLayout() public static method

Checks to see if the passed in item has presentation settings for the provided device and layout.
public static ItemHasPresentationSettingsForLayout ( Item theItem, DeviceItem device, LayoutItem layoutItem ) : bool
theItem Item The item.
device DeviceItem The device.
layoutItem LayoutItem The layout item.
return bool

ItemHasPresentationSettingsForSublayout() public static method

Checks to see if the passed in item has presentation settings for the provided device and sublayout.
public static ItemHasPresentationSettingsForSublayout ( Item theItem, DeviceItem device, SublayoutItem sublayoutItem ) : bool
theItem Item The item.
device DeviceItem The device.
sublayoutItem SublayoutItem The sublayout item.
return bool

TemplateHasPresentationSetDirectlyOnTemplate() public static method

Checks whether the presenation settings are set directly on a template, this should ususally be set on the standard values.
public static TemplateHasPresentationSetDirectlyOnTemplate ( TemplateItem template ) : bool
template TemplateItem The template to check.
return bool