Class BlockListPropertyValueConverter
Inheritance
Namespace: Umbraco.Cms.Core.PropertyEditors.ValueConverters
Assembly: Umbraco.Infrastructure.dll
Syntax
public class BlockListPropertyValueConverter : BlockPropertyValueConverterBase<BlockListModel, BlockListItem, BlockListLayoutItem, BlockListConfiguration.BlockConfiguration>, IDeliveryApiPropertyValueConverter, IPropertyValueConverter, IDiscoverable
Constructors
View SourceBlockListPropertyValueConverter(IProfilingLogger, BlockEditorConverter)
Declaration
public BlockListPropertyValueConverter(IProfilingLogger proflog, BlockEditorConverter blockConverter)
Parameters
Type | Name | Description |
---|---|---|
IProfilingLogger | proflog | |
BlockEditorConverter | blockConverter |
BlockListPropertyValueConverter(IProfilingLogger, BlockEditorConverter, IContentTypeService)
Declaration
public BlockListPropertyValueConverter(IProfilingLogger proflog, BlockEditorConverter blockConverter, IContentTypeService contentTypeService)
Parameters
Type | Name | Description |
---|---|---|
IProfilingLogger | proflog | |
BlockEditorConverter | blockConverter | |
IContentTypeService | contentTypeService |
BlockListPropertyValueConverter(IProfilingLogger, BlockEditorConverter, IContentTypeService, IApiElementBuilder)
Declaration
public BlockListPropertyValueConverter(IProfilingLogger proflog, BlockEditorConverter blockConverter, IContentTypeService contentTypeService, IApiElementBuilder apiElementBuilder)
Parameters
Type | Name | Description |
---|---|---|
IProfilingLogger | proflog | |
BlockEditorConverter | blockConverter | |
IContentTypeService | contentTypeService | |
IApiElementBuilder | apiElementBuilder |
Methods
View SourceConvertIntermediateToDeliveryApiObject(IPublishedElement, IPublishedPropertyType, PropertyCacheLevel, Object, Boolean, Boolean)
Converts a property intermediate value to an Object value for Delivery API representation.
Declaration
public object ConvertIntermediateToDeliveryApiObject(IPublishedElement owner, IPublishedPropertyType propertyType, PropertyCacheLevel referenceCacheLevel, object inter, bool preview, bool expanding)
Parameters
Type | Name | Description |
---|---|---|
IPublishedElement | owner | The property set owning the property. |
IPublishedPropertyType | propertyType | The property type. |
PropertyCacheLevel | referenceCacheLevel | The reference cache level. |
System.Object | inter | The intermediate value. |
System.Boolean | preview | A value indicating whether conversion should take place in preview mode. |
System.Boolean | expanding | A value indicating whether the property value should be expanded (if applicable). |
Returns
Type | Description |
---|---|
System.Object | The result of the conversion. |
Remarks
The converter should know how to convert a null
intermediate value, or any intermediate value
indicating that no value has been assigned to the property. It is up to the converter to determine
what to return in that case: either null
, or the default value...
The referenceCacheLevel
is passed to the converter so that it can be, in turn,
passed to eg a PublishedFragment constructor. It is used by the fragment and the properties to manage
the cache levels of property values. It is not meant to be used by the converter.
ConvertIntermediateToObject(IPublishedElement, IPublishedPropertyType, PropertyCacheLevel, Object, Boolean)
Converts a property intermediate value to an Object value.
Declaration
public override object ConvertIntermediateToObject(IPublishedElement owner, IPublishedPropertyType propertyType, PropertyCacheLevel referenceCacheLevel, object inter, bool preview)
Parameters
Type | Name | Description |
---|---|---|
IPublishedElement | owner | The property set owning the property. |
IPublishedPropertyType | propertyType | The property type. |
PropertyCacheLevel | referenceCacheLevel | The reference cache level. |
System.Object | inter | The intermediate value. |
System.Boolean | preview | A value indicating whether conversion should take place in preview mode. |
Returns
Type | Description |
---|---|
System.Object | The result of the conversion. |
Remarks
The converter should know how to convert a null
intermediate value, or any intermediate value
indicating that no value has been assigned to the property. It is up to the converter to determine
what to return in that case: either null
, or the default value...
The referenceCacheLevel
is passed to the converter so that it can be, in turn,
passed to eg a PublishedFragment constructor. It is used by the fragment and the properties to manage
the cache levels of property values. It is not meant to be used by the converter.
ConvertSourceToIntermediate(IPublishedElement, IPublishedPropertyType, Object, Boolean)
Converts a property source value to an intermediate value.
Declaration
public override object ConvertSourceToIntermediate(IPublishedElement owner, IPublishedPropertyType propertyType, object source, bool preview)
Parameters
Type | Name | Description |
---|---|---|
IPublishedElement | owner | The property set owning the property. |
IPublishedPropertyType | propertyType | The property type. |
System.Object | source | The source value. |
System.Boolean | preview | A value indicating whether conversion should take place in preview mode. |
Returns
Type | Description |
---|---|
System.Object | The result of the conversion. |
Remarks
The converter should know how to convert a null
source value, meaning that no
value has been assigned to the property. The intermediate value can be null
.
With the XML cache, source values come from the XML cache and therefore are strings.
With objects caches, source values would come from the database and therefore be either ints, DateTimes, decimals, or strings.
The converter should be prepared to handle both situations.
When source values are strings, the converter must handle empty strings, whitespace strings, and xml-whitespace strings appropriately, ie it should know whether to preserve white spaces.
CreateBlockEditorDataConverter()
Declaration
protected override BlockEditorDataConverter CreateBlockEditorDataConverter()
Returns
Type | Description |
---|---|
BlockEditorDataConverter |
CreateBlockItemActivator()
Declaration
protected override BlockPropertyValueConverterBase<BlockListModel, BlockListItem, BlockListLayoutItem, BlockListConfiguration.BlockConfiguration>.BlockItemActivator<BlockListItem> CreateBlockItemActivator()
Returns
Type | Description |
---|---|
BlockPropertyValueConverterBase.BlockItemActivator<BlockListItem> |
GetDeliveryApiPropertyCacheLevel(IPublishedPropertyType)
Gets the property cache level for Delivery API representation.
Declaration
public PropertyCacheLevel GetDeliveryApiPropertyCacheLevel(IPublishedPropertyType propertyType)
Parameters
Type | Name | Description |
---|---|---|
IPublishedPropertyType | propertyType | The property type. |
Returns
Type | Description |
---|---|
PropertyCacheLevel | The property cache level. |
GetDeliveryApiPropertyValueType(IPublishedPropertyType)
Declaration
public Type GetDeliveryApiPropertyValueType(IPublishedPropertyType propertyType)
Parameters
Type | Name | Description |
---|---|---|
IPublishedPropertyType | propertyType |
Returns
Type | Description |
---|---|
Type |
GetPropertyCacheLevel(IPublishedPropertyType)
Gets the property cache level.
Declaration
public override PropertyCacheLevel GetPropertyCacheLevel(IPublishedPropertyType propertyType)
Parameters
Type | Name | Description |
---|---|---|
IPublishedPropertyType | propertyType | The property type. |
Returns
Type | Description |
---|---|
PropertyCacheLevel | The property cache level. |
GetPropertyValueType(IPublishedPropertyType)
Gets the type of values returned by the converter.
Declaration
public override Type GetPropertyValueType(IPublishedPropertyType propertyType)
Parameters
Type | Name | Description |
---|---|---|
IPublishedPropertyType | propertyType | The property type. |
Returns
Type | Description |
---|---|
Type | The CLR type of values returned by the converter. |
Remarks
Some of the CLR types may be generated, therefore this method cannot directly return a Type object (which may not exist yet). In which case it needs to return a ModelType instance.
IsConverter(IPublishedPropertyType)
Gets a value indicating whether the converter supports a property type.
Declaration
public override bool IsConverter(IPublishedPropertyType propertyType)
Parameters
Type | Name | Description |
---|---|---|
IPublishedPropertyType | propertyType | The property type. |
Returns
Type | Description |
---|---|
System.Boolean | A value indicating whether the converter supports a property type. |