Class FriendlyPublishedElementExtensions
Inheritance
Namespace: Umbraco.Extensions
Assembly: Umbraco.Web.Common.dll
Syntax
public static class FriendlyPublishedElementExtensionsMethods
View SourceIsVisible(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.
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.
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.
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 : IPublishedElementParameters
| 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 |