Show / Hide Table of Contents
    View Source

    Class PublishedContentExtensions

    Provides extension methods for IPublishedContent.

    Inheritance
    System.Object
    Namespace:System.Dynamic.ExpandoObject
    Assembly:Umbraco.Web.dll
    Syntax
    public static class PublishedContentExtensions

    Methods

    View Source

    Ancestor(IPublishedContent)

    Gets the ancestor of the content, ie its parent.

    Declaration
    public static IPublishedContent Ancestor(this IPublishedContent content)
    Parameters
    Type Name Description
    IPublishedContent content

    The content.

    Returns
    Type Description
    IPublishedContent

    The ancestor of the content.

    Remarks

    This method is here for consistency purposes but does not make much sense.

    View Source

    Ancestor(IPublishedContent, Int32)

    Gets the nearest ancestor of the content, at a lever lesser or equal to a specified level.

    Declaration
    public static IPublishedContent Ancestor(this IPublishedContent content, int maxLevel)
    Parameters
    Type Name Description
    IPublishedContent content

    The content.

    System.Int32 maxLevel

    The level.

    Returns
    Type Description
    IPublishedContent

    The nearest (in down-top order) ancestor of the content, at a level lesser or equal to the specified level.

    Remarks

    Does not consider the content itself. May return null.

    View Source

    Ancestor(IPublishedContent, String)

    Gets the nearest ancestor of the content, of a specified content type.

    Declaration
    public static IPublishedContent Ancestor(this IPublishedContent content, string contentTypeAlias)
    Parameters
    Type Name Description
    IPublishedContent content

    The content.

    System.String contentTypeAlias

    The content type alias.

    Returns
    Type Description
    IPublishedContent

    The nearest (in down-top order) ancestor of the content, of the specified content type.

    Remarks

    Does not consider the content itself. May return null.

    View Source

    Ancestor<T>(IPublishedContent)

    Gets the nearest ancestor of the content, of a specified content type.

    Declaration
    public static T Ancestor<T>(this IPublishedContent content)
        where T : class, IPublishedContent
    Parameters
    Type Name Description
    IPublishedContent content

    The content.

    Returns
    Type Description
    T

    The nearest (in down-top order) ancestor of the content, of the specified content type.

    Type Parameters
    Name Description
    T

    The content type.

    Remarks

    Does not consider the content itself. May return null.

    View Source

    Ancestor<T>(IPublishedContent, Int32)

    Gets the nearest ancestor of the content, at the specified level and of the specified content type.

    Declaration
    public static T Ancestor<T>(this IPublishedContent content, int maxLevel)
        where T : class, IPublishedContent
    Parameters
    Type Name Description
    IPublishedContent content

    The content.

    System.Int32 maxLevel

    The level.

    Returns
    Type Description
    T

    The ancestor of the content, at the specified level and of the specified content type.

    Type Parameters
    Name Description
    T

    The content type.

    Remarks

    Does not consider the content itself. If the ancestor at the specified level is not of the specified type, returns null.

    View Source

    AncestorOrSelf(IPublishedContent)

    Gets the content or its nearest ancestor.

    Declaration
    public static IPublishedContent AncestorOrSelf(this IPublishedContent content)
    Parameters
    Type Name Description
    IPublishedContent content

    The content.

    Returns
    Type Description
    IPublishedContent

    The content.

    Remarks

    This method is here for consistency purposes but does not make much sense.

    View Source

    AncestorOrSelf(IPublishedContent, Int32)

    Gets the content or its nearest ancestor, at a lever lesser or equal to a specified level.

    Declaration
    public static IPublishedContent AncestorOrSelf(this IPublishedContent content, int maxLevel)
    Parameters
    Type Name Description
    IPublishedContent content

    The content.

    System.Int32 maxLevel

    The level.

    Returns
    Type Description
    IPublishedContent

    The content or its nearest (in down-top order) ancestor, at a level lesser or equal to the specified level.

    Remarks

    May or may not return the content itself depending on its level. May return null.

    View Source

    AncestorOrSelf(IPublishedContent, String)

    Gets the content or its nearest ancestor, of a specified content type.

    Declaration
    public static IPublishedContent AncestorOrSelf(this IPublishedContent content, string contentTypeAlias)
    Parameters
    Type Name Description
    IPublishedContent content

    The content.

    System.String contentTypeAlias

    The content type.

    Returns
    Type Description
    IPublishedContent

    The content or its nearest (in down-top order) ancestor, of the specified content type.

    Remarks

    May or may not return the content itself depending on its content type. May return null.

    View Source

    AncestorOrSelf<T>(IPublishedContent)

    Gets the content or its nearest ancestor, of a specified content type.

    Declaration
    public static T AncestorOrSelf<T>(this IPublishedContent content)
        where T : class, IPublishedContent
    Parameters
    Type Name Description
    IPublishedContent content

    The content.

    Returns
    Type Description
    T

    The content or its nearest (in down-top order) ancestor, of the specified content type.

    Type Parameters
    Name Description
    T

    The content type.

    Remarks

    May or may not return the content itself depending on its content type. May return null.

    View Source

    AncestorOrSelf<T>(IPublishedContent, Int32)

    Gets the content or its nearest ancestor, at a lever lesser or equal to a specified level, and of a specified content type.

    Declaration
    public static T AncestorOrSelf<T>(this IPublishedContent content, int maxLevel)
        where T : class, IPublishedContent
    Parameters
    Type Name Description
    IPublishedContent content

    The content.

    System.Int32 maxLevel

    The level.

    Returns
    Type Description
    T
    Type Parameters
    Name Description
    T

    The content type.

    View Source

    Ancestors(IPublishedContent)

    Gets the ancestors of the content.

    Declaration
    public static IEnumerable<IPublishedContent> Ancestors(this IPublishedContent content)
    Parameters
    Type Name Description
    IPublishedContent content

    The content.

    Returns
    Type Description
    System.Collections.Generic.IEnumerable<IPublishedContent>

    The ancestors of the content, in down-top order.

    Remarks

    Does not consider the content itself.

    View Source

    Ancestors(IPublishedContent, Int32)

    Gets the ancestors of the content, at a level lesser or equal to a specified level.

    Declaration
    public static IEnumerable<IPublishedContent> Ancestors(this IPublishedContent content, int maxLevel)
    Parameters
    Type Name Description
    IPublishedContent content

    The content.

    System.Int32 maxLevel

    The level.

    Returns
    Type Description
    System.Collections.Generic.IEnumerable<IPublishedContent>

    The ancestors of the content, at a level lesser or equal to the specified level, in down-top order.

    Remarks

    Does not consider the content itself. Only content that are "high enough" in the tree are returned.

    View Source

    Ancestors(IPublishedContent, String)

    Gets the ancestors of the content, of a specified content type.

    Declaration
    public static IEnumerable<IPublishedContent> Ancestors(this IPublishedContent content, string contentTypeAlias)
    Parameters
    Type Name Description
    IPublishedContent content

    The content.

    System.String contentTypeAlias

    The content type.

    Returns
    Type Description
    System.Collections.Generic.IEnumerable<IPublishedContent>

    The ancestors of the content, of the specified content type, in down-top order.

    Remarks

    Does not consider the content itself. Returns all ancestors, of the specified content type.

    View Source

    Ancestors<T>(IPublishedContent)

    Gets the ancestors of the content, of a specified content type.

    Declaration
    public static IEnumerable<T> Ancestors<T>(this IPublishedContent content)
        where T : class, IPublishedContent
    Parameters
    Type Name Description
    IPublishedContent content

    The content.

    Returns
    Type Description
    System.Collections.Generic.IEnumerable<T>

    The ancestors of the content, of the specified content type, in down-top order.

    Type Parameters
    Name Description
    T

    The content type.

    Remarks

    Does not consider the content itself. Returns all ancestors, of the specified content type.

    View Source

    Ancestors<T>(IPublishedContent, Int32)

    Gets the ancestors of the content, at a level lesser or equal to a specified level, and of a specified content type.

    Declaration
    public static IEnumerable<T> Ancestors<T>(this IPublishedContent content, int maxLevel)
        where T : class, IPublishedContent
    Parameters
    Type Name Description
    IPublishedContent content

    The content.

    System.Int32 maxLevel

    The level.

    Returns
    Type Description
    System.Collections.Generic.IEnumerable<T>

    The ancestors of the content, at a level lesser or equal to the specified level, and of the specified content type, in down-top order.

    Type Parameters
    Name Description
    T

    The content type.

    Remarks

    Does not consider the content itself. Only content that are "high enough" in the trees, and of the specified content type, are returned.

    View Source

    AncestorsOrSelf(IPublishedContent)

    Gets the content and its ancestors.

    Declaration
    public static IEnumerable<IPublishedContent> AncestorsOrSelf(this IPublishedContent content)
    Parameters
    Type Name Description
    IPublishedContent content

    The content.

    Returns
    Type Description
    System.Collections.Generic.IEnumerable<IPublishedContent>

    The content and its ancestors, in down-top order.

    View Source

    AncestorsOrSelf(IPublishedContent, Boolean, Func<IPublishedContent, Boolean>)

    Declaration
    public static IEnumerable<IPublishedContent> AncestorsOrSelf(this IPublishedContent content, bool orSelf, Func<IPublishedContent, bool> func)
    Parameters
    Type Name Description
    IPublishedContent content
    System.Boolean orSelf
    System.Func<IPublishedContent, System.Boolean> func
    Returns
    Type Description
    System.Collections.Generic.IEnumerable<IPublishedContent>
    View Source

    AncestorsOrSelf(IPublishedContent, Int32)

    Gets the content and its ancestors, at a level lesser or equal to a specified level.

    Declaration
    public static IEnumerable<IPublishedContent> AncestorsOrSelf(this IPublishedContent content, int maxLevel)
    Parameters
    Type Name Description
    IPublishedContent content

    The content.

    System.Int32 maxLevel

    The level.

    Returns
    Type Description
    System.Collections.Generic.IEnumerable<IPublishedContent>

    The content and its ancestors, at a level lesser or equal to the specified level, in down-top order.

    Remarks

    Only content that are "high enough" in the tree are returned. So it may or may not begin with the content itself, depending on its level.

    View Source

    AncestorsOrSelf(IPublishedContent, String)

    Gets the content and its ancestors, of a specified content type.

    Declaration
    public static IEnumerable<IPublishedContent> AncestorsOrSelf(this IPublishedContent content, string contentTypeAlias)
    Parameters
    Type Name Description
    IPublishedContent content

    The content.

    System.String contentTypeAlias

    The content type.

    Returns
    Type Description
    System.Collections.Generic.IEnumerable<IPublishedContent>

    The content and its ancestors, of the specified content type, in down-top order.

    Remarks

    May or may not begin with the content itself, depending on its content type.

    View Source

    AncestorsOrSelf<T>(IPublishedContent)

    Gets the content and its ancestors, of a specified content type.

    Declaration
    public static IEnumerable<T> AncestorsOrSelf<T>(this IPublishedContent content)
        where T : class, IPublishedContent
    Parameters
    Type Name Description
    IPublishedContent content

    The content.

    Returns
    Type Description
    System.Collections.Generic.IEnumerable<T>

    The content and its ancestors, of the specified content type, in down-top order.

    Type Parameters
    Name Description
    T

    The content type.

    Remarks

    May or may not begin with the content itself, depending on its content type.

    View Source

    AncestorsOrSelf<T>(IPublishedContent, Int32)

    Gets the content and its ancestor, at a lever lesser or equal to a specified level, and of a specified content type.

    Declaration
    public static IEnumerable<T> AncestorsOrSelf<T>(this IPublishedContent content, int maxLevel)
        where T : class, IPublishedContent
    Parameters
    Type Name Description
    IPublishedContent content

    The content.

    System.Int32 maxLevel

    The level.

    Returns
    Type Description
    System.Collections.Generic.IEnumerable<T>

    The content and its ancestors, at a level lesser or equal to the specified level, and of the specified content type, in down-top order.

    Type Parameters
    Name Description
    T

    The content type.

    Remarks

    May or may not begin with the content itself, depending on its level and content type.

    View Source

    Children(IPublishedContent, Func<IPublishedContent, Boolean>, String)

    Gets the children of the content, filtered by a predicate.

    Declaration
    public static IEnumerable<IPublishedContent> Children(this IPublishedContent content, Func<IPublishedContent, bool> predicate, string culture = null)
    Parameters
    Type Name Description
    IPublishedContent content

    The content.

    System.Func<IPublishedContent, System.Boolean> predicate

    The predicate.

    System.String culture

    The specific culture to filter for. If null is used the current culture is used. (Default is null)

    Returns
    Type Description
    System.Collections.Generic.IEnumerable<IPublishedContent>

    The children of the content, filtered by the predicate.

    Remarks

    Children are sorted by their sortOrder.

    View Source

    Children<T>(IPublishedContent, String)

    Gets the children of the content, of a given content type.

    Declaration
    public static IEnumerable<T> Children<T>(this IPublishedContent content, string culture = null)
        where T : class, IPublishedContent
    Parameters
    Type Name Description
    IPublishedContent content

    The content.

    System.String culture

    The specific culture to filter for. If null is used the current culture is used. (Default is null)

    Returns
    Type Description
    System.Collections.Generic.IEnumerable<T>

    The children of content, of the given content type.

    Type Parameters
    Name Description
    T

    The content type.

    Remarks

    Children are sorted by their sortOrder.

    View Source

    ChildrenAsTable(IPublishedContent, ServiceContext, String, String)

    Gets the children of the content in a DataTable.

    Declaration
    public static DataTable ChildrenAsTable(this IPublishedContent content, ServiceContext services, string contentTypeAliasFilter = "", string culture = null)
    Parameters
    Type Name Description
    IPublishedContent content

    The content.

    ServiceContext services

    A service context.

    System.String contentTypeAliasFilter

    An optional content type alias.

    System.String culture

    The specific culture to filter for. If null is used the current culture is used. (Default is null)

    Returns
    Type Description
    System.Data.DataTable

    The children of the content.

    View Source

    ChildrenOfType(IPublishedContent, String, String)

    Gets the children of the content, of any of the specified types.

    Declaration
    public static IEnumerable<IPublishedContent> ChildrenOfType(this IPublishedContent content, string contentTypeAlias, string culture = null)
    Parameters
    Type Name Description
    IPublishedContent content

    The content.

    System.String contentTypeAlias

    The content type alias.

    System.String culture

    The specific culture to filter for. If null is used the current culture is used. (Default is null)

    Returns
    Type Description
    System.Collections.Generic.IEnumerable<IPublishedContent>

    The children of the content, of any of the specified types.

    View Source

    CreatorName(IPublishedContent, IUserService)

    Declaration
    public static string CreatorName(this IPublishedContent content, IUserService userService)
    Parameters
    Type Name Description
    IPublishedContent content
    IUserService userService
    Returns
    Type Description
    System.String
    View Source

    Descendant(IPublishedContent, Int32, String)

    Declaration
    public static IPublishedContent Descendant(this IPublishedContent content, int level, string culture = null)
    Parameters
    Type Name Description
    IPublishedContent content
    System.Int32 level
    System.String culture
    Returns
    Type Description
    IPublishedContent
    View Source

    Descendant(IPublishedContent, String)

    Declaration
    public static IPublishedContent Descendant(this IPublishedContent content, string culture = null)
    Parameters
    Type Name Description
    IPublishedContent content
    System.String culture
    Returns
    Type Description
    IPublishedContent
    View Source

    Descendant<T>(IPublishedContent, Int32, String)

    Declaration
    public static T Descendant<T>(this IPublishedContent content, int level, string culture = null)
        where T : class, IPublishedContent
    Parameters
    Type Name Description
    IPublishedContent content
    System.Int32 level
    System.String culture
    Returns
    Type Description
    T
    Type Parameters
    Name Description
    T
    View Source

    Descendant<T>(IPublishedContent, String)

    Declaration
    public static T Descendant<T>(this IPublishedContent content, string culture = null)
        where T : class, IPublishedContent
    Parameters
    Type Name Description
    IPublishedContent content
    System.String culture
    Returns
    Type Description
    T
    Type Parameters
    Name Description
    T
    View Source

    DescendantOfType(IPublishedContent, String, String)

    Declaration
    public static IPublishedContent DescendantOfType(this IPublishedContent content, string contentTypeAlias, string culture = null)
    Parameters
    Type Name Description
    IPublishedContent content
    System.String contentTypeAlias
    System.String culture
    Returns
    Type Description
    IPublishedContent
    View Source

    DescendantOrSelf(IPublishedContent, Int32, String)

    Declaration
    public static IPublishedContent DescendantOrSelf(this IPublishedContent content, int level, string culture = null)
    Parameters
    Type Name Description
    IPublishedContent content
    System.Int32 level
    System.String culture
    Returns
    Type Description
    IPublishedContent
    View Source

    DescendantOrSelf(IPublishedContent, String)

    Declaration
    public static IPublishedContent DescendantOrSelf(this IPublishedContent content, string culture = null)
    Parameters
    Type Name Description
    IPublishedContent content
    System.String culture
    Returns
    Type Description
    IPublishedContent
    View Source

    DescendantOrSelf<T>(IPublishedContent, Int32, String)

    Declaration
    public static T DescendantOrSelf<T>(this IPublishedContent content, int level, string culture = null)
        where T : class, IPublishedContent
    Parameters
    Type Name Description
    IPublishedContent content
    System.Int32 level
    System.String culture
    Returns
    Type Description
    T
    Type Parameters
    Name Description
    T
    View Source

    DescendantOrSelf<T>(IPublishedContent, String)

    Declaration
    public static T DescendantOrSelf<T>(this IPublishedContent content, string culture = null)
        where T : class, IPublishedContent
    Parameters
    Type Name Description
    IPublishedContent content
    System.String culture
    Returns
    Type Description
    T
    Type Parameters
    Name Description
    T
    View Source

    DescendantOrSelfOfType(IPublishedContent, String, String)

    Declaration
    public static IPublishedContent DescendantOrSelfOfType(this IPublishedContent content, string contentTypeAlias, string culture = null)
    Parameters
    Type Name Description
    IPublishedContent content
    System.String contentTypeAlias
    System.String culture
    Returns
    Type Description
    IPublishedContent
    View Source

    Descendants(IPublishedContent, Int32, String)

    Declaration
    public static IEnumerable<IPublishedContent> Descendants(this IPublishedContent content, int level, string culture = null)
    Parameters
    Type Name Description
    IPublishedContent content
    System.Int32 level
    System.String culture
    Returns
    Type Description
    System.Collections.Generic.IEnumerable<IPublishedContent>
    View Source

    Descendants(IPublishedContent, String)

    Declaration
    public static IEnumerable<IPublishedContent> Descendants(this IPublishedContent content, string culture = null)
    Parameters
    Type Name Description
    IPublishedContent content
    System.String culture
    Returns
    Type Description
    System.Collections.Generic.IEnumerable<IPublishedContent>
    View Source

    Descendants<T>(IPublishedContent, Int32, String)

    Declaration
    public static IEnumerable<T> Descendants<T>(this IPublishedContent content, int level, string culture = null)
        where T : class, IPublishedContent
    Parameters
    Type Name Description
    IPublishedContent content
    System.Int32 level
    System.String culture
    Returns
    Type Description
    System.Collections.Generic.IEnumerable<T>
    Type Parameters
    Name Description
    T
    View Source

    Descendants<T>(IPublishedContent, String)

    Declaration
    public static IEnumerable<T> Descendants<T>(this IPublishedContent content, string culture = null)
        where T : class, IPublishedContent
    Parameters
    Type Name Description
    IPublishedContent content
    System.String culture
    Returns
    Type Description
    System.Collections.Generic.IEnumerable<T>
    Type Parameters
    Name Description
    T
    View Source

    DescendantsOfType(IPublishedContent, String, String)

    Declaration
    public static IEnumerable<IPublishedContent> DescendantsOfType(this IPublishedContent content, string contentTypeAlias, string culture = null)
    Parameters
    Type Name Description
    IPublishedContent content
    System.String contentTypeAlias
    System.String culture
    Returns
    Type Description
    System.Collections.Generic.IEnumerable<IPublishedContent>
    View Source

    DescendantsOrSelf(IPublishedContent, Int32, String)

    Declaration
    public static IEnumerable<IPublishedContent> DescendantsOrSelf(this IPublishedContent content, int level, string culture = null)
    Parameters
    Type Name Description
    IPublishedContent content
    System.Int32 level
    System.String culture
    Returns
    Type Description
    System.Collections.Generic.IEnumerable<IPublishedContent>
    View Source

    DescendantsOrSelf(IPublishedContent, String)

    Declaration
    public static IEnumerable<IPublishedContent> DescendantsOrSelf(this IPublishedContent content, string culture = null)
    Parameters
    Type Name Description
    IPublishedContent content
    System.String culture
    Returns
    Type Description
    System.Collections.Generic.IEnumerable<IPublishedContent>
    View Source

    DescendantsOrSelf<T>(IEnumerable<IPublishedContent>, String)

    Returns all DescendantsOrSelf of all content referenced

    Declaration
    public static IEnumerable<T> DescendantsOrSelf<T>(this IEnumerable<IPublishedContent> parentNodes, string culture = null)
        where T : class, IPublishedContent
    Parameters
    Type Name Description
    System.Collections.Generic.IEnumerable<IPublishedContent> parentNodes
    System.String culture

    The specific culture to filter for. If null is used the current culture is used. (Default is null)

    Returns
    Type Description
    System.Collections.Generic.IEnumerable<T>
    Type Parameters
    Name Description
    T
    Remarks

    This can be useful in order to return all nodes in an entire site by a type when combined with ContentAtRoot() or similar.

    View Source

    DescendantsOrSelf<T>(IPublishedContent, Int32, String)

    Declaration
    public static IEnumerable<T> DescendantsOrSelf<T>(this IPublishedContent content, int level, string culture = null)
        where T : class, IPublishedContent
    Parameters
    Type Name Description
    IPublishedContent content
    System.Int32 level
    System.String culture
    Returns
    Type Description
    System.Collections.Generic.IEnumerable<T>
    Type Parameters
    Name Description
    T
    View Source

    DescendantsOrSelf<T>(IPublishedContent, String)

    Declaration
    public static IEnumerable<T> DescendantsOrSelf<T>(this IPublishedContent content, string culture = null)
        where T : class, IPublishedContent
    Parameters
    Type Name Description
    IPublishedContent content
    System.String culture
    Returns
    Type Description
    System.Collections.Generic.IEnumerable<T>
    Type Parameters
    Name Description
    T
    View Source

    DescendantsOrSelfOfType(IEnumerable<IPublishedContent>, String, String)

    Returns all DescendantsOrSelf of all content referenced

    Declaration
    public static IEnumerable<IPublishedContent> DescendantsOrSelfOfType(this IEnumerable<IPublishedContent> parentNodes, string docTypeAlias, string culture = null)
    Parameters
    Type Name Description
    System.Collections.Generic.IEnumerable<IPublishedContent> parentNodes
    System.String docTypeAlias
    System.String culture

    The specific culture to filter for. If null is used the current culture is used. (Default is null)

    Returns
    Type Description
    System.Collections.Generic.IEnumerable<IPublishedContent>
    Remarks

    This can be useful in order to return all nodes in an entire site by a type when combined with ContentAtRoot() or similar.

    View Source

    DescendantsOrSelfOfType(IPublishedContent, String, String)

    Declaration
    public static IEnumerable<IPublishedContent> DescendantsOrSelfOfType(this IPublishedContent content, string contentTypeAlias, string culture = null)
    Parameters
    Type Name Description
    IPublishedContent content
    System.String contentTypeAlias
    System.String culture
    Returns
    Type Description
    System.Collections.Generic.IEnumerable<IPublishedContent>
    View Source

    FirstChild(IPublishedContent, Func<IPublishedContent, Boolean>, String)

    Declaration
    public static IPublishedContent FirstChild(this IPublishedContent content, Func<IPublishedContent, bool> predicate, string culture = null)
    Parameters
    Type Name Description
    IPublishedContent content
    System.Func<IPublishedContent, System.Boolean> predicate
    System.String culture
    Returns
    Type Description
    IPublishedContent
    View Source

    FirstChild(IPublishedContent, Guid, String)

    Declaration
    public static IPublishedContent FirstChild(this IPublishedContent content, Guid uniqueId, string culture = null)
    Parameters
    Type Name Description
    IPublishedContent content
    System.Guid uniqueId
    System.String culture
    Returns
    Type Description
    IPublishedContent
    View Source

    FirstChild(IPublishedContent, String)

    Declaration
    public static IPublishedContent FirstChild(this IPublishedContent content, string culture = null)
    Parameters
    Type Name Description
    IPublishedContent content
    System.String culture
    Returns
    Type Description
    IPublishedContent
    View Source

    FirstChild<T>(IPublishedContent, Func<T, Boolean>, String)

    Declaration
    public static T FirstChild<T>(this IPublishedContent content, Func<T, bool> predicate, string culture = null)
        where T : class, IPublishedContent
    Parameters
    Type Name Description
    IPublishedContent content
    System.Func<T, System.Boolean> predicate
    System.String culture
    Returns
    Type Description
    T
    Type Parameters
    Name Description
    T
    View Source

    FirstChild<T>(IPublishedContent, String)

    Declaration
    public static T FirstChild<T>(this IPublishedContent content, string culture = null)
        where T : class, IPublishedContent
    Parameters
    Type Name Description
    IPublishedContent content
    System.String culture
    Returns
    Type Description
    T
    Type Parameters
    Name Description
    T
    View Source

    FirstChildOfType(IPublishedContent, String, String)

    Gets the first child of the content, of a given content type.

    Declaration
    public static IPublishedContent FirstChildOfType(this IPublishedContent content, string contentTypeAlias, string culture = null)
    Parameters
    Type Name Description
    IPublishedContent content
    System.String contentTypeAlias
    System.String culture
    Returns
    Type Description
    IPublishedContent
    View Source

    GetCultureFromDomains(IPublishedContent, Uri)

    Gets the culture assigned to a document by domains, in the context of a current Uri.

    Declaration
    public static string GetCultureFromDomains(this IPublishedContent content, Uri current = null)
    Parameters
    Type Name Description
    IPublishedContent content

    The document.

    System.Uri current

    An optional current Uri.

    Returns
    Type Description
    System.String

    The culture assigned to the document by domains.

    Remarks

    In 1:1 multilingual setup, a document contains several cultures (there is not one document per culture), and domains, withing the context of a current Uri, assign a culture to that document.

    View Source

    GetTemplateAlias(IPublishedContent)

    Returns the current template Alias

    Declaration
    public static string GetTemplateAlias(this IPublishedContent content)
    Parameters
    Type Name Description
    IPublishedContent content
    Returns
    Type Description
    System.String

    Empty string if none is set.

    View Source

    HasValue(IPublishedContent, String, String, String, Fallback)

    Gets a value indicating whether the content has a value for a property identified by its alias.

    Declaration
    public static bool HasValue(this IPublishedContent content, string alias, string culture = null, string segment = null, Fallback fallback = default(Fallback))
    Parameters
    Type Name Description
    IPublishedContent content

    The content.

    System.String alias

    The property alias.

    System.String culture

    The variation language.

    System.String segment

    The variation segment.

    Fallback fallback

    Optional fallback strategy.

    Returns
    Type Description
    System.Boolean

    A value indicating whether the content has a value for the property identified by the alias.

    Remarks

    Returns true if HasValue is true, or a fallback strategy can provide a value.

    View Source

    IsAllowedTemplate(IPublishedContent, Int32)

    Declaration
    public static bool IsAllowedTemplate(this IPublishedContent content, int templateId)
    Parameters
    Type Name Description
    IPublishedContent content
    System.Int32 templateId
    Returns
    Type Description
    System.Boolean
    View Source

    IsAllowedTemplate(IPublishedContent, String)

    Declaration
    public static bool IsAllowedTemplate(this IPublishedContent content, string templateAlias)
    Parameters
    Type Name Description
    IPublishedContent content
    System.String templateAlias
    Returns
    Type Description
    System.Boolean
    View Source

    IsAncestor(IPublishedContent, IPublishedContent)

    Declaration
    public static bool IsAncestor(this IPublishedContent content, IPublishedContent other)
    Parameters
    Type Name Description
    IPublishedContent content
    IPublishedContent other
    Returns
    Type Description
    System.Boolean
    View Source

    IsAncestor(IPublishedContent, IPublishedContent, String)

    If the specified content is an ancestor of other, the HTML encoded valueIfTrue will be returned; otherwise, System.String.Empty.

    Declaration
    public static HtmlString IsAncestor(this IPublishedContent content, IPublishedContent other, string valueIfTrue)
    Parameters
    Type Name Description
    IPublishedContent content

    The content.

    IPublishedContent other

    The other content.

    System.String valueIfTrue

    The value if true.

    Returns
    Type Description
    System.Web.HtmlString

    The HTML encoded value.

    View Source

    IsAncestor(IPublishedContent, IPublishedContent, String, String)

    If the specified content is an ancestor of other, the HTML encoded valueIfTrue will be returned; otherwise, valueIfFalse.

    Declaration
    public static HtmlString IsAncestor(this IPublishedContent content, IPublishedContent other, string valueIfTrue, string valueIfFalse)
    Parameters
    Type Name Description
    IPublishedContent content

    The content.

    IPublishedContent other

    The other content.

    System.String valueIfTrue

    The value if true.

    System.String valueIfFalse

    The value if false.

    Returns
    Type Description
    System.Web.HtmlString

    The HTML encoded value.

    View Source

    IsAncestorOrSelf(IPublishedContent, IPublishedContent)

    Declaration
    public static bool IsAncestorOrSelf(this IPublishedContent content, IPublishedContent other)
    Parameters
    Type Name Description
    IPublishedContent content
    IPublishedContent other
    Returns
    Type Description
    System.Boolean
    View Source

    IsAncestorOrSelf(IPublishedContent, IPublishedContent, String)

    If the specified content is an ancestor of other or are the same, the HTML encoded valueIfTrue will be returned; otherwise, System.String.Empty.

    Declaration
    public static HtmlString IsAncestorOrSelf(this IPublishedContent content, IPublishedContent other, string valueIfTrue)
    Parameters
    Type Name Description
    IPublishedContent content

    The content.

    IPublishedContent other

    The other content.

    System.String valueIfTrue

    The value if true.

    Returns
    Type Description
    System.Web.HtmlString

    The HTML encoded value.

    View Source

    IsAncestorOrSelf(IPublishedContent, IPublishedContent, String, String)

    If the specified content is an ancestor of other or are the same, the HTML encoded valueIfTrue will be returned; otherwise, valueIfFalse.

    Declaration
    public static HtmlString IsAncestorOrSelf(this IPublishedContent content, IPublishedContent other, string valueIfTrue, string valueIfFalse)
    Parameters
    Type Name Description
    IPublishedContent content

    The content.

    IPublishedContent other

    The other content.

    System.String valueIfTrue

    The value if true.

    System.String valueIfFalse

    The value if false.

    Returns
    Type Description
    System.Web.HtmlString

    The HTML encoded value.

    View Source

    IsComposedOf(IPublishedContent, String)

    Gets a value indicating whether the content is of a content type composed of the given alias

    Declaration
    public static bool IsComposedOf(this IPublishedContent content, string alias)
    Parameters
    Type Name Description
    IPublishedContent content

    The content.

    System.String alias

    The content type alias.

    Returns
    Type Description
    System.Boolean

    A value indicating whether the content is of a content type composed of a content type identified by the alias.

    View Source

    IsDescendant(IPublishedContent, IPublishedContent)

    Declaration
    public static bool IsDescendant(this IPublishedContent content, IPublishedContent other)
    Parameters
    Type Name Description
    IPublishedContent content
    IPublishedContent other
    Returns
    Type Description
    System.Boolean
    View Source

    IsDescendant(IPublishedContent, IPublishedContent, String)

    If the specified content is a decendant of other, the HTML encoded valueIfTrue will be returned; otherwise, System.String.Empty.

    Declaration
    public static HtmlString IsDescendant(this IPublishedContent content, IPublishedContent other, string valueIfTrue)
    Parameters
    Type Name Description
    IPublishedContent content

    The content.

    IPublishedContent other

    The other content.

    System.String valueIfTrue

    The value if true.

    Returns
    Type Description
    System.Web.HtmlString

    The HTML encoded value.

    View Source

    IsDescendant(IPublishedContent, IPublishedContent, String, String)

    If the specified content is a decendant of other, the HTML encoded valueIfTrue will be returned; otherwise, valueIfFalse.

    Declaration
    public static HtmlString IsDescendant(this IPublishedContent content, IPublishedContent other, string valueIfTrue, string valueIfFalse)
    Parameters
    Type Name Description
    IPublishedContent content

    The content.

    IPublishedContent other

    The other content.

    System.String valueIfTrue

    The value if true.

    System.String valueIfFalse

    The value if false.

    Returns
    Type Description
    System.Web.HtmlString

    The HTML encoded value.

    View Source

    IsDescendantOrSelf(IPublishedContent, IPublishedContent)

    Declaration
    public static bool IsDescendantOrSelf(this IPublishedContent content, IPublishedContent other)
    Parameters
    Type Name Description
    IPublishedContent content
    IPublishedContent other
    Returns
    Type Description
    System.Boolean
    View Source

    IsDescendantOrSelf(IPublishedContent, IPublishedContent, String)

    If the specified content is a decendant of other or are the same, the HTML encoded valueIfTrue will be returned; otherwise, System.String.Empty.

    Declaration
    public static HtmlString IsDescendantOrSelf(this IPublishedContent content, IPublishedContent other, string valueIfTrue)
    Parameters
    Type Name Description
    IPublishedContent content

    The content.

    IPublishedContent other

    The other content.

    System.String valueIfTrue

    The value if true.

    Returns
    Type Description
    System.Web.HtmlString

    The HTML encoded value.

    View Source

    IsDescendantOrSelf(IPublishedContent, IPublishedContent, String, String)

    If the specified content is a decendant of other or are the same, the HTML encoded valueIfTrue will be returned; otherwise, valueIfFalse.

    Declaration
    public static HtmlString IsDescendantOrSelf(this IPublishedContent content, IPublishedContent other, string valueIfTrue, string valueIfFalse)
    Parameters
    Type Name Description
    IPublishedContent content

    The content.

    IPublishedContent other

    The other content.

    System.String valueIfTrue

    The value if true.

    System.String valueIfFalse

    The value if false.

    Returns
    Type Description
    System.Web.HtmlString

    The HTML encoded value.

    View Source

    IsDocumentType(IPublishedContent, String)

    Determines whether the specified content is a specified content type.

    Declaration
    public static bool IsDocumentType(this IPublishedContent content, string docTypeAlias)
    Parameters
    Type Name Description
    IPublishedContent content

    The content to determine content type of.

    System.String docTypeAlias

    The alias of the content type to test against.

    Returns
    Type Description
    System.Boolean

    True if the content is of the specified content type; otherwise false.

    View Source

    IsDocumentType(IPublishedContent, String, Boolean)

    Determines whether the specified content is a specified content type or it's derived types.

    Declaration
    public static bool IsDocumentType(this IPublishedContent content, string docTypeAlias, bool recursive)
    Parameters
    Type Name Description
    IPublishedContent content

    The content to determine content type of.

    System.String docTypeAlias

    The alias of the content type to test against.

    System.Boolean recursive

    When true, recurses up the content type tree to check inheritance; when false just calls IsDocumentType(this IPublishedContent content, string docTypeAlias).

    Returns
    Type Description
    System.Boolean

    True if the content is of the specified content type or a derived content type; otherwise false.

    View Source

    IsEqual(IPublishedContent, IPublishedContent)

    Declaration
    public static bool IsEqual(this IPublishedContent content, IPublishedContent other)
    Parameters
    Type Name Description
    IPublishedContent content
    IPublishedContent other
    Returns
    Type Description
    System.Boolean
    View Source

    IsEqual(IPublishedContent, IPublishedContent, String)

    If the specified content is equal to other, the HTML encoded valueIfTrue will be returned; otherwise, System.String.Empty.

    Declaration
    public static HtmlString IsEqual(this IPublishedContent content, IPublishedContent other, string valueIfTrue)
    Parameters
    Type Name Description
    IPublishedContent content

    The content.

    IPublishedContent other

    The other content.

    System.String valueIfTrue

    The value if true.

    Returns
    Type Description
    System.Web.HtmlString

    The HTML encoded value.

    View Source

    IsEqual(IPublishedContent, IPublishedContent, String, String)

    If the specified content is equal to other, the HTML encoded valueIfTrue will be returned; otherwise, valueIfFalse.

    Declaration
    public static HtmlString IsEqual(this IPublishedContent content, IPublishedContent other, string valueIfTrue, string valueIfFalse)
    Parameters
    Type Name Description
    IPublishedContent content

    The content.

    IPublishedContent other

    The other content.

    System.String valueIfTrue

    The value if true.

    System.String valueIfFalse

    The value if false.

    Returns
    Type Description
    System.Web.HtmlString

    The HTML encoded value.

    View Source

    IsNotEqual(IPublishedContent, IPublishedContent)

    If the specified content is not equal to other, the HTML encoded valueIfTrue will be returned; otherwise, valueIfFalse.

    Declaration
    public static bool IsNotEqual(this IPublishedContent content, IPublishedContent other)
    Parameters
    Type Name Description
    IPublishedContent content

    The content.

    IPublishedContent other

    The other content.

    Returns
    Type Description
    System.Boolean

    The HTML encoded value.

    View Source

    IsNotEqual(IPublishedContent, IPublishedContent, String)

    If the specified content is not equal to other, the HTML encoded valueIfTrue will be returned; otherwise, System.String.Empty.

    Declaration
    public static HtmlString IsNotEqual(this IPublishedContent content, IPublishedContent other, string valueIfTrue)
    Parameters
    Type Name Description
    IPublishedContent content

    The content.

    IPublishedContent other

    The other content.

    System.String valueIfTrue

    The value if true.

    Returns
    Type Description
    System.Web.HtmlString

    The HTML encoded value.

    View Source

    IsNotEqual(IPublishedContent, IPublishedContent, String, String)

    If the specified content is not equal to other, the HTML encoded valueIfTrue will be returned; otherwise, valueIfFalse.

    Declaration
    public static HtmlString IsNotEqual(this IPublishedContent content, IPublishedContent other, string valueIfTrue, string valueIfFalse)
    Parameters
    Type Name Description
    IPublishedContent content

    The content.

    IPublishedContent other

    The other content.

    System.String valueIfTrue

    The value if true.

    System.String valueIfFalse

    The value if false.

    Returns
    Type Description
    System.Web.HtmlString

    The HTML encoded value.

    View Source

    Parent<T>(IPublishedContent)

    Gets the parent of the content, of a given content type.

    Declaration
    public static T Parent<T>(this IPublishedContent content)
        where T : class, IPublishedContent
    Parameters
    Type Name Description
    IPublishedContent content

    The content.

    Returns
    Type Description
    T

    The parent of content, of the given content type, else null.

    Type Parameters
    Name Description
    T

    The content type.

    View Source

    Root(IPublishedContent)

    Gets the root content for this content.

    Declaration
    public static IPublishedContent Root(this IPublishedContent content)
    Parameters
    Type Name Description
    IPublishedContent content

    The content.

    Returns
    Type Description
    IPublishedContent

    The 'site' content ie AncestorOrSelf(1).

    View Source

    SearchChildren(IPublishedContent, String, String)

    Declaration
    public static IEnumerable<PublishedSearchResult> SearchChildren(this IPublishedContent content, string term, string indexName = null)
    Parameters
    Type Name Description
    IPublishedContent content
    System.String term
    System.String indexName
    Returns
    Type Description
    System.Collections.Generic.IEnumerable<PublishedSearchResult>
    View Source

    SearchDescendants(IPublishedContent, String, String)

    Declaration
    public static IEnumerable<PublishedSearchResult> SearchDescendants(this IPublishedContent content, string term, string indexName = null)
    Parameters
    Type Name Description
    IPublishedContent content
    System.String term
    System.String indexName
    Returns
    Type Description
    System.Collections.Generic.IEnumerable<PublishedSearchResult>
    View Source

    Siblings(IPublishedContent, String)

    Gets the siblings of the content.

    Declaration
    public static IEnumerable<IPublishedContent> Siblings(this IPublishedContent content, string culture = null)
    Parameters
    Type Name Description
    IPublishedContent content

    The content.

    System.String culture

    The specific culture to filter for. If null is used the current culture is used. (Default is null)

    Returns
    Type Description
    System.Collections.Generic.IEnumerable<IPublishedContent>

    The siblings of the content.

    Remarks

    Note that in V7 this method also return the content node self.

    View Source

    Siblings<T>(IPublishedContent, String)

    Gets the siblings of the content, of a given content type.

    Declaration
    public static IEnumerable<T> Siblings<T>(this IPublishedContent content, string culture = null)
        where T : class, IPublishedContent
    Parameters
    Type Name Description
    IPublishedContent content

    The content.

    System.String culture

    The specific culture to filter for. If null is used the current culture is used. (Default is null)

    Returns
    Type Description
    System.Collections.Generic.IEnumerable<T>

    The siblings of the content, of the given content type.

    Type Parameters
    Name Description
    T

    The content type.

    Remarks

    Note that in V7 this method also return the content node self.

    View Source

    SiblingsAndSelf(IPublishedContent, String)

    Gets the siblings of the content including the node itself to indicate the position.

    Declaration
    public static IEnumerable<IPublishedContent> SiblingsAndSelf(this IPublishedContent content, string culture = null)
    Parameters
    Type Name Description
    IPublishedContent content

    The content.

    System.String culture

    The specific culture to filter for. If null is used the current culture is used. (Default is null)

    Returns
    Type Description
    System.Collections.Generic.IEnumerable<IPublishedContent>

    The siblings of the content including the node itself.

    View Source

    SiblingsAndSelf<T>(IPublishedContent, String)

    Gets the siblings of the content including the node itself to indicate the position, of a given content type.

    Declaration
    public static IEnumerable<T> SiblingsAndSelf<T>(this IPublishedContent content, string culture = null)
        where T : class, IPublishedContent
    Parameters
    Type Name Description
    IPublishedContent content

    The content.

    System.String culture

    The specific culture to filter for. If null is used the current culture is used. (Default is null)

    Returns
    Type Description
    System.Collections.Generic.IEnumerable<T>

    The siblings of the content including the node itself, of the given content type.

    Type Parameters
    Name Description
    T

    The content type.

    View Source

    SiblingsAndSelfOfType(IPublishedContent, String, String)

    Gets the siblings of the content including the node itself to indicate the position, of a given content type.

    Declaration
    public static IEnumerable<IPublishedContent> SiblingsAndSelfOfType(this IPublishedContent content, string contentTypeAlias, string culture = null)
    Parameters
    Type Name Description
    IPublishedContent content

    The content.

    System.String contentTypeAlias

    The content type alias.

    System.String culture

    The specific culture to filter for. If null is used the current culture is used. (Default is null)

    Returns
    Type Description
    System.Collections.Generic.IEnumerable<IPublishedContent>

    The siblings of the content including the node itself, of the given content type.

    View Source

    SiblingsOfType(IPublishedContent, String, String)

    Gets the siblings of the content, of a given content type.

    Declaration
    public static IEnumerable<IPublishedContent> SiblingsOfType(this IPublishedContent content, string contentTypeAlias, string culture = null)
    Parameters
    Type Name Description
    IPublishedContent content

    The content.

    System.String contentTypeAlias

    The content type alias.

    System.String culture

    The specific culture to filter for. If null is used the current culture is used. (Default is null)

    Returns
    Type Description
    System.Collections.Generic.IEnumerable<IPublishedContent>

    The siblings of the content, of the given content type.

    Remarks

    Note that in V7 this method also return the content node self.

    View Source

    Url(IPublishedContent, String, UrlMode)

    Gets the url of the content item.

    Declaration
    public static string Url(this IPublishedContent content, string culture = null, UrlMode mode = UrlMode.Default)
    Parameters
    Type Name Description
    IPublishedContent content
    System.String culture
    UrlMode mode
    Returns
    Type Description
    System.String
    Remarks

    If the content item is a document, then this method returns the url of the document. If it is a media, then this methods return the media url for the 'umbracoFile' property. Use the MediaUrl() method to get the media url for other properties.

    The value of this property is contextual. It depends on the 'current' request uri, if any. In addition, when the content type is multi-lingual, this is the url for the specified culture. Otherwise, it is the invariant url.

    View Source

    Value(IPublishedContent, String, String, String, Fallback, Object)

    Gets the value of a content's property identified by its alias, if it exists, otherwise a default value.

    Declaration
    public static object Value(this IPublishedContent content, string alias, string culture = null, string segment = null, Fallback fallback = default(Fallback), object defaultValue = null)
    Parameters
    Type Name Description
    IPublishedContent content

    The content.

    System.String alias

    The property alias.

    System.String culture

    The variation language.

    System.String segment

    The variation segment.

    Fallback fallback

    Optional fallback strategy.

    System.Object defaultValue

    The default value.

    Returns
    Type Description
    System.Object

    The value of the content's property identified by the alias, if it exists, otherwise a default value.

    View Source

    Value<T>(IPublishedContent, String, String, String, Fallback, T)

    Gets the value of a content's property identified by its alias, converted to a specified type.

    Declaration
    public static T Value<T>(this IPublishedContent content, string alias, string culture = null, string segment = null, Fallback fallback = default(Fallback), T defaultValue = null)
    Parameters
    Type Name Description
    IPublishedContent content

    The content.

    System.String alias

    The property alias.

    System.String culture

    The variation language.

    System.String segment

    The variation segment.

    Fallback fallback

    Optional fallback strategy.

    T defaultValue

    The default value.

    Returns
    Type Description
    T

    The value of the content's property identified by the alias, converted to the specified type.

    Type Parameters
    Name Description
    T

    The target property type.

    View Source

    WriterName(IPublishedContent, IUserService)

    Declaration
    public static string WriterName(this IPublishedContent content, IUserService userService)
    Parameters
    Type Name Description
    IPublishedContent content
    IUserService userService
    Returns
    Type Description
    System.String
    • Improve this Doc
    • View Source
    Back to top Copyright © 2016-present Umbraco
    Generated by DocFX