Search Results for

    Show / Hide Table of Contents
    View Source

    Class FriendlyPublishedElementExtensions

    Inheritance
    System.Object
    Namespace: Umbraco.Extensions
    Assembly: Umbraco.Web.Common.dll
    Syntax
    public static class FriendlyPublishedElementExtensions

    Methods

    View Source

    IsVisible(IPublishedElement)

    Gets a value indicating whether the content is visible.

    Declaration
    public static bool IsVisible(this IPublishedElement content)
    Parameters
    Type Name Description
    IPublishedElement content

    The content.

    Returns
    Type Description
    System.Boolean

    A value indicating whether the content is visible.

    Remarks

    A content is not visible if it has an umbracoNaviHide property with a value of "1". Otherwise, the content is visible.

    View Source

    Value(IPublishedElement, String, String, String, Fallback, Object)

    Gets the value of a content's property identified by its alias.

    Declaration
    public static object Value(this IPublishedElement content, string alias, string culture = null, string segment = null, Fallback fallback = null, object defaultValue = null)
    Parameters
    Type Name Description
    IPublishedElement 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.

    Remarks

    The value comes from IPublishedProperty field Value ie it is suitable for use when rendering content.

    If no property with the specified alias exists, or if the property has no value, returns defaultValue.

    If eg a numeric property wants to default to 0 when value source is empty, this has to be done in the converter.

    The alias is case-insensitive.

    View Source

    Value<T>(IPublishedElement, 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 IPublishedElement content, string alias, string culture = null, string segment = null, Fallback fallback = null, T defaultValue = null)
    Parameters
    Type Name Description
    IPublishedElement 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.

    Remarks

    The value comes from IPublishedProperty field Value ie it is suitable for use when rendering content.

    If no property with the specified alias exists, or if the property has no value, or if it could not be converted, returns default(T).

    If eg a numeric property wants to default to 0 when value source is empty, this has to be done in the converter.

    The alias is case-insensitive.

    View Source

    ValueFor<TModel, TValue>(TModel, Expression<Func<TModel, TValue>>, String, String, Fallback, TValue)

    Gets the value of a property.

    Declaration
    public static TValue ValueFor<TModel, TValue>(this TModel model, Expression<Func<TModel, TValue>> property, string culture = null, string segment = null, Fallback fallback = null, TValue defaultValue = null)
        where TModel : IPublishedElement
    Parameters
    Type Name Description
    TModel model
    System.Linq.Expressions.Expression<Func<TModel, TValue>> property
    System.String culture
    System.String segment
    Fallback fallback
    TValue defaultValue
    Returns
    Type Description
    TValue
    Type Parameters
    Name Description
    TModel
    TValue
    • Improve this Doc
    • View Source
    In This Article
    • Methods
      • IsVisible(IPublishedElement)
      • Value(IPublishedElement, String, String, String, Fallback, Object)
      • Value<T>(IPublishedElement, String, String, String, Fallback, T)
      • ValueFor<TModel, TValue>(TModel, Expression<Func<TModel, TValue>>, String, String, Fallback, TValue)
    Back to top Copyright © 2016-present Umbraco
    Generated by DocFX