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

Afficher le fichier Open project: Velir/Sitecore-Commons

Méthodes publiques

Méthode 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

Méthode 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 méthode

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
Résultat TemplateItem>.IDictionary

GetCheckboxValue() public static méthode

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
Résultat bool

GetDateFieldValue() public static méthode

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
Résultat System.DateTime

GetSite() public static méthode

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

GetTextFieldValue() public static méthode

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
Résultat String

HasBaseTemplate() public static méthode

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
Résultat bool

HasRelationToTemplate() public static méthode

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
Résultat bool

HasRelationToTemplate() public static méthode

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
Résultat bool