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

Datei anzeigen Open project: Velir/Sitecore-Commons

Public Methods

Method Description
GetBaseTemplates ( System.Item item ) : TemplateItem>.IDictionary

Returns a LinkField value from a Sitecore LinkField. If the field is null, or does not contain a value, it'll create an empty LinkField with a Url of "#"

Returns a hash map of TemplateItems comprised of all the base templates of the specified Sitecore item. Notice that the lookup stops at the "Standard Template", so base templates such as "Appearance", "Masters", "Workflow", etc. won't be included in the list.

GetCheckboxValue ( System.Item item, String fieldName ) : bool

Provides a boolean value for Checkboxes.

GetDateFieldValue ( System.Item item, String fieldName ) : System.DateTime

Returns a DateTime value from a Sitecore date/time field. If the item does not contain a valid DateField, or the DateField is not set, then DateTime.MinValue will be returned.

GetSite ( System.Item item ) : SiteInfo

Find proper site based on the passed item

GetTextFieldValue ( System.Item item, String fieldName ) : String

Return a string value from a Sitecore text based field

HasBaseTemplate ( System.Item item, string templateName ) : bool

Determines whether a given sitecore item descends from the specified base template. Notice that the lookup stops at the "Standard Template", so base templates such as "Appearance", "Masters", "Workflow", etc. won't be included in the search.

HasRelationToTemplate ( Database db, string templateId, System.Item item ) : bool

Determines whether a given Sitecore item is of a certain template or descends from the provided tempalte Id. Standard Tempaltes are excluded.

HasRelationToTemplate ( string templateId, System.Item item ) : bool

Determines whether a given Sitecore item is of a certain template or descends from the provided tempalte Id. Standard Tempaltes are excluded.

Private Methods

Method Description
AddBaseTemplates ( TemplateItem>.Dictionary dict, TemplateItem template ) : void

Recursively look up base templates for the specified item and add them to the list. Notice that the lookup stops at the "Standard Template", so base templates such as "Appearance", "Masters", "Workflow", etc. won't be included in the list.

Method Details

GetBaseTemplates() public static method

Returns a LinkField value from a Sitecore LinkField. If the field is null, or does not contain a value, it'll create an empty LinkField with a Url of "#" Returns a hash map of TemplateItems comprised of all the base templates of the specified Sitecore item. Notice that the lookup stops at the "Standard Template", so base templates such as "Appearance", "Masters", "Workflow", etc. won't be included in the list.
public static GetBaseTemplates ( System.Item item ) : TemplateItem>.IDictionary
item System.Item Sitecore Item with a LinkField
return TemplateItem>.IDictionary

GetCheckboxValue() public static method

Provides a boolean value for Checkboxes.
public static GetCheckboxValue ( System.Item item, String fieldName ) : bool
item System.Item Sitecore Item with Checkbox
fieldName String Name of Checkbox Field
return bool

GetDateFieldValue() public static method

Returns a DateTime value from a Sitecore date/time field. If the item does not contain a valid DateField, or the DateField is not set, then DateTime.MinValue will be returned.
public static GetDateFieldValue ( System.Item item, String fieldName ) : System.DateTime
item System.Item Sitecore Item with a date/time field
fieldName String Name of Sitecore field
return System.DateTime

GetSite() public static method

Find proper site based on the passed item
public static GetSite ( System.Item item ) : SiteInfo
item System.Item
return SiteInfo

GetTextFieldValue() public static method

Return a string value from a Sitecore text based field
public static GetTextFieldValue ( System.Item item, String fieldName ) : String
item System.Item Sitecore Item with a text field
fieldName String Name of Sitecore field
return String

HasBaseTemplate() public static method

Determines whether a given sitecore item descends from the specified base template. Notice that the lookup stops at the "Standard Template", so base templates such as "Appearance", "Masters", "Workflow", etc. won't be included in the search.
public static HasBaseTemplate ( System.Item item, string templateName ) : bool
item System.Item a sitecore item
templateName string the name of the base template you're looking for
return bool

HasRelationToTemplate() public static method

Determines whether a given Sitecore item is of a certain template or descends from the provided tempalte Id. Standard Tempaltes are excluded.
public static HasRelationToTemplate ( Database db, string templateId, System.Item item ) : bool
db Database Sitecore Database
templateId string String Template Id
item System.Item Sitecore Item
return bool

HasRelationToTemplate() public static method

Determines whether a given Sitecore item is of a certain template or descends from the provided tempalte Id. Standard Tempaltes are excluded.
public static HasRelationToTemplate ( string templateId, System.Item item ) : bool
templateId string String Template Id
item System.Item Sitecore Item
return bool