C# Class Sitecore.Modules.WeBlog.Extensions.ItemExtensions

Provides utilities for working with Sitecore items
Mostra file Open project: WeTeam/WeBlog

Public Methods

Method Description
DoesFieldRequireWrapping ( this item, string fieldName ) : bool

Determines if the field given by name needs to have it's output wrapped in an additional tag

FindAncestorByAnyTemplate ( this item, IEnumerable templateIds ) : System.Item

Finds the current type of item for the given item

FindAncestorByTemplate ( this item, ID templateId ) : System.Item

Finds the current type of item for the given item

FindAncestorByTemplate ( this item, string template ) : System.Item

Finds the current type of item for the given item

FindItemsByTemplateOrDerivedTemplate ( this rootItem, TemplateItem template ) : System.Item[]

Find items below another based on the specified template or a derived template

GetItemTitle ( this item ) : string

Gets the content of the title field if not empty, otherwise the item name

GetUrl ( this item ) : string

Get the URL for an item

TemplateIsOrBasedOn ( this item, ID templateId ) : bool

Determine if an item is based on a given template or if the item's template is based on the given template

TemplateIsOrBasedOn ( this item, IEnumerable templateIds ) : bool

Determine if an item is based on a given template or if the item's template is based on the given template

Private Methods

Method Description
GetCurrentItem ( this item, ID templateId ) : System.Item
GetCurrentItem ( this item, string template ) : System.Item
TemplateIsOrBasedOn ( TemplateItem itemTemplate, ID baseTemplate ) : bool
TemplateIsOrBasedOn ( TemplateItem itemTemplate, TemplateItem baseTemplate ) : bool
TemplateIsOrBasedOn ( this item, TemplateItem template ) : bool

Method Details

DoesFieldRequireWrapping() public static method

Determines if the field given by name needs to have it's output wrapped in an additional tag
public static DoesFieldRequireWrapping ( this item, string fieldName ) : bool
item this The item to check field on
fieldName string The name of the field to check
return bool

FindAncestorByAnyTemplate() public static method

Finds the current type of item for the given item
public static FindAncestorByAnyTemplate ( this item, IEnumerable templateIds ) : System.Item
item this The item to search from
templateIds IEnumerable The template the target item must be based on or derived from
return System.Item

FindAncestorByTemplate() public static method

Finds the current type of item for the given item
public static FindAncestorByTemplate ( this item, ID templateId ) : System.Item
item this The item to search from
templateId ID The template the target item must be based on or derived from
return System.Item

FindAncestorByTemplate() public static method

Finds the current type of item for the given item
public static FindAncestorByTemplate ( this item, string template ) : System.Item
item this The item to search from
template string The template the target item must be based on or derived from
return System.Item

FindItemsByTemplateOrDerivedTemplate() public static method

Find items below another based on the specified template or a derived template
public static FindItemsByTemplateOrDerivedTemplate ( this rootItem, TemplateItem template ) : System.Item[]
rootItem this The item the item must be below
template TemplateItem The template to find item based on, or based on derivaties of the template
return System.Item[]

GetItemTitle() public static method

Gets the content of the title field if not empty, otherwise the item name
public static GetItemTitle ( this item ) : string
item this The item to get the title for
return string

GetUrl() public static method

Get the URL for an item
public static GetUrl ( this item ) : string
item this The item to get the URL for
return string

TemplateIsOrBasedOn() public static method

Determine if an item is based on a given template or if the item's template is based on the given template
public static TemplateIsOrBasedOn ( this item, ID templateId ) : bool
item this The item to test the template of
templateId ID The ID of the template which the item's template should be or inherit from
return bool

TemplateIsOrBasedOn() public static method

Determine if an item is based on a given template or if the item's template is based on the given template
public static TemplateIsOrBasedOn ( this item, IEnumerable templateIds ) : bool
item this The item to test the template of
templateIds IEnumerable The IDs of the templates which the item's template should be or inherit from
return bool