Class ContentVariationExtensions
Provides extension methods for content variations.
Inheritance
Namespace: Umbraco.Core
Assembly: Umbraco.Core.dll
Syntax
public static class ContentVariationExtensions
Methods
View SourceSetFlag(ContentVariation, ContentVariation, Boolean)
Returns the variations with the variation set or removed depending on the specified value.
Declaration
public static ContentVariation SetFlag(this ContentVariation variations, ContentVariation variation, bool value = true)
Parameters
Type | Name | Description |
---|---|---|
ContentVariation | variations | The existing variations. |
ContentVariation | variation | The variation to set or remove. |
System.Boolean | value | If set to |
Returns
Type | Description |
---|---|
ContentVariation | The variations with the variation set or removed. |
Remarks
This method does not support setting the variation to nothing.
SetVariesBy(IContentTypeBase, ContentVariation, Boolean)
Sets or removes the content type variation depending on the specified value.
Declaration
public static void SetVariesBy(this IContentTypeBase contentType, ContentVariation variation, bool value = true)
Parameters
Type | Name | Description |
---|---|---|
IContentTypeBase | contentType | The content type. |
ContentVariation | variation | The variation to set or remove. |
System.Boolean | value | If set to |
Remarks
This method does not support setting the variation to nothing.
SetVariesBy(PropertyType, ContentVariation, Boolean)
Sets or removes the property type variation depending on the specified value.
Declaration
public static void SetVariesBy(this PropertyType propertyType, ContentVariation variation, bool value = true)
Parameters
Type | Name | Description |
---|---|---|
PropertyType | propertyType | The property type. |
ContentVariation | variation | The variation to set or remove. |
System.Boolean | value | If set to |
Remarks
This method does not support setting the variation to nothing.
ValidateVariation(ContentVariation, String, String, Boolean, Boolean, Boolean)
Validates that a combination of culture and segment is valid for the variation.
Declaration
public static bool ValidateVariation(this ContentVariation variation, string culture, string segment, bool exact, bool wildcards, bool throwIfInvalid)
Parameters
Type | Name | Description |
---|---|---|
ContentVariation | variation | The variation. |
System.String | culture | The culture. |
System.String | segment | The segment. |
System.Boolean | exact | A value indicating whether to perform exact validation. |
System.Boolean | wildcards | A value indicating whether to support wildcards. |
System.Boolean | throwIfInvalid | A value indicating whether to throw a System.NotSupportedException when the combination is invalid. |
Returns
Type | Description |
---|---|
System.Boolean |
|
Remarks
When validation is exact, the combination must match the variation exactly. For instance, if the variation is Culture, then a culture is required. When validation is not strict, the combination must be equivalent, or more restrictive: if the variation is Culture, an invariant combination is ok.
Basically, exact is for one content type, or one property type, and !exact is for "all property types" of one content type.
Both culture
and segment
can be "*" to indicate "all of them".
Exceptions
Type | Condition |
---|---|
System.NotSupportedException | Occurs when the combination is invalid, and |
VariesByCulture(ContentVariation)
Determines whether a variation varies by culture.
Declaration
public static bool VariesByCulture(this ContentVariation variation)
Parameters
Type | Name | Description |
---|---|---|
ContentVariation | variation | The variation. |
Returns
Type | Description |
---|---|
System.Boolean | A value indicating whether the variation varies by culture. |
VariesByCulture(IContentTypeBase)
Determines whether the content type varies by culture.
Declaration
public static bool VariesByCulture(this IContentTypeBase contentType)
Parameters
Type | Name | Description |
---|---|---|
IContentTypeBase | contentType | The content type. |
Returns
Type | Description |
---|---|
System.Boolean | A value indicating whether the content type varies by culture. |
VariesByCulture(ISimpleContentType)
Determines whether the content type varies by culture.
Declaration
public static bool VariesByCulture(this ISimpleContentType contentType)
Parameters
Type | Name | Description |
---|---|---|
ISimpleContentType | contentType | The content type. |
Returns
Type | Description |
---|---|
System.Boolean | A value indicating whether the content type varies by culture. |
VariesByCulture(PropertyType)
Determines whether the property type varies by culture.
Declaration
public static bool VariesByCulture(this PropertyType propertyType)
Parameters
Type | Name | Description |
---|---|---|
PropertyType | propertyType | The property type. |
Returns
Type | Description |
---|---|
System.Boolean | A value indicating whether the property type varies by culture. |
VariesByCulture(IPublishedContentType)
Determines whether the content type varies by culture.
Declaration
public static bool VariesByCulture(this IPublishedContentType contentType)
Parameters
Type | Name | Description |
---|---|---|
IPublishedContentType | contentType | The content type. |
Returns
Type | Description |
---|---|
System.Boolean | A value indicating whether the content type varies by culture. |
VariesByCulture(IPublishedPropertyType)
Determines whether the property type varies by culture.
Declaration
public static bool VariesByCulture(this IPublishedPropertyType propertyType)
Parameters
Type | Name | Description |
---|---|---|
IPublishedPropertyType | propertyType | The property type. |
Returns
Type | Description |
---|---|
System.Boolean | A value indicating whether the property type varies by culture. |
VariesByCultureAndSegment(ContentVariation)
Determines whether a variation varies by culture and segment.
Declaration
public static bool VariesByCultureAndSegment(this ContentVariation variation)
Parameters
Type | Name | Description |
---|---|---|
ContentVariation | variation | The variation. |
Returns
Type | Description |
---|---|
System.Boolean | A value indicating whether the variation varies by culture and segment. |
VariesByCultureAndSegment(IContentTypeBase)
Determines whether the content type varies by culture and segment.
Declaration
public static bool VariesByCultureAndSegment(this IContentTypeBase contentType)
Parameters
Type | Name | Description |
---|---|---|
IContentTypeBase | contentType | The content type. |
Returns
Type | Description |
---|---|
System.Boolean | A value indicating whether the content type varies by culture and segment. |
VariesByCultureAndSegment(ISimpleContentType)
Determines whether the content type varies by culture and segment.
Declaration
public static bool VariesByCultureAndSegment(this ISimpleContentType contentType)
Parameters
Type | Name | Description |
---|---|---|
ISimpleContentType | contentType | The content type. |
Returns
Type | Description |
---|---|
System.Boolean | A value indicating whether the content type varies by culture and segment. |
VariesByCultureAndSegment(PropertyType)
Determines whether the property type varies by culture and segment.
Declaration
public static bool VariesByCultureAndSegment(this PropertyType propertyType)
Parameters
Type | Name | Description |
---|---|---|
PropertyType | propertyType | The property type. |
Returns
Type | Description |
---|---|
System.Boolean | A value indicating whether the property type varies by culture and segment. |
VariesByCultureAndSegment(IPublishedContentType)
Determines whether the content type varies by culture and segment.
Declaration
public static bool VariesByCultureAndSegment(this IPublishedContentType contentType)
Parameters
Type | Name | Description |
---|---|---|
IPublishedContentType | contentType | The content type. |
Returns
Type | Description |
---|---|
System.Boolean | A value indicating whether the content type varies by culture and segment. |
VariesByCultureAndSegment(IPublishedPropertyType)
Determines whether the property type varies by culture and segment.
Declaration
public static bool VariesByCultureAndSegment(this IPublishedPropertyType propertyType)
Parameters
Type | Name | Description |
---|---|---|
IPublishedPropertyType | propertyType | The property type. |
Returns
Type | Description |
---|---|
System.Boolean | A value indicating whether the property type varies by culture and segment. |
VariesByNothing(ContentVariation)
Determines whether a variation is invariant.
Declaration
public static bool VariesByNothing(this ContentVariation variation)
Parameters
Type | Name | Description |
---|---|---|
ContentVariation | variation | The variation. |
Returns
Type | Description |
---|---|
System.Boolean | A value indicating whether the variation is invariant. |
VariesByNothing(IContentTypeBase)
Determines whether the content type is invariant.
Declaration
public static bool VariesByNothing(this IContentTypeBase contentType)
Parameters
Type | Name | Description |
---|---|---|
IContentTypeBase | contentType | The content type. |
Returns
Type | Description |
---|---|
System.Boolean | A value indicating whether the content type is invariant. |
VariesByNothing(ISimpleContentType)
Determines whether the content type is invariant.
Declaration
public static bool VariesByNothing(this ISimpleContentType contentType)
Parameters
Type | Name | Description |
---|---|---|
ISimpleContentType | contentType | The content type. |
Returns
Type | Description |
---|---|
System.Boolean | A value indicating whether the content type is invariant. |
VariesByNothing(PropertyType)
Determines whether the property type is invariant.
Declaration
public static bool VariesByNothing(this PropertyType propertyType)
Parameters
Type | Name | Description |
---|---|---|
PropertyType | propertyType | The property type. |
Returns
Type | Description |
---|---|
System.Boolean | A value indicating whether the property type is invariant. |
VariesByNothing(IPublishedContentType)
Determines whether the content type is invariant.
Declaration
public static bool VariesByNothing(this IPublishedContentType contentType)
Parameters
Type | Name | Description |
---|---|---|
IPublishedContentType | contentType | The content type. |
Returns
Type | Description |
---|---|
System.Boolean | A value indicating whether the content type is invariant. |
VariesByNothing(IPublishedPropertyType)
Determines whether the property type is invariant.
Declaration
public static bool VariesByNothing(this IPublishedPropertyType propertyType)
Parameters
Type | Name | Description |
---|---|---|
IPublishedPropertyType | propertyType | The property type. |
Returns
Type | Description |
---|---|
System.Boolean | A value indicating whether the property type is invariant. |
VariesBySegment(ContentVariation)
Determines whether a variation varies by segment.
Declaration
public static bool VariesBySegment(this ContentVariation variation)
Parameters
Type | Name | Description |
---|---|---|
ContentVariation | variation | The variation. |
Returns
Type | Description |
---|---|
System.Boolean | A value indicating whether the variation varies by segment. |
VariesBySegment(IContentTypeBase)
Determines whether the content type varies by segment.
Declaration
public static bool VariesBySegment(this IContentTypeBase contentType)
Parameters
Type | Name | Description |
---|---|---|
IContentTypeBase | contentType | The content type. |
Returns
Type | Description |
---|---|
System.Boolean | A value indicating whether the content type varies by segment. |
VariesBySegment(ISimpleContentType)
Determines whether the content type varies by segment.
Declaration
public static bool VariesBySegment(this ISimpleContentType contentType)
Parameters
Type | Name | Description |
---|---|---|
ISimpleContentType | contentType | The content type. |
Returns
Type | Description |
---|---|
System.Boolean | A value indicating whether the content type varies by segment. |
VariesBySegment(PropertyType)
Determines whether the property type varies by segment.
Declaration
public static bool VariesBySegment(this PropertyType propertyType)
Parameters
Type | Name | Description |
---|---|---|
PropertyType | propertyType | The property type. |
Returns
Type | Description |
---|---|
System.Boolean | A value indicating whether the property type varies by segment. |
VariesBySegment(IPublishedContentType)
Determines whether the content type varies by segment.
Declaration
public static bool VariesBySegment(this IPublishedContentType contentType)
Parameters
Type | Name | Description |
---|---|---|
IPublishedContentType | contentType | The content type. |
Returns
Type | Description |
---|---|
System.Boolean | A value indicating whether the content type varies by segment. |
VariesBySegment(IPublishedPropertyType)
Determines whether the property type varies by segment.
Declaration
public static bool VariesBySegment(this IPublishedPropertyType propertyType)
Parameters
Type | Name | Description |
---|---|---|
IPublishedPropertyType | propertyType | The property type. |
Returns
Type | Description |
---|---|
System.Boolean | A value indicating whether the property type varies by segment. |