Search Results for

    Show / Hide Table of Contents
    View Source

    Class RteBlockRenderingValueConverter

    A value converter for TinyMCE that will ensure any blocks content are rendered properly even when used dynamically.

    Inheritance
    object
    PropertyValueConverterBase
    SimpleRichTextValueConverter
    Namespace: Umbraco.Cms.Core.PropertyEditors.ValueConverters
    Assembly: Umbraco.Infrastructure.dll
    Syntax
    [DefaultPropertyValueConverter]
    public class RteBlockRenderingValueConverter : SimpleRichTextValueConverter, IDeliveryApiPropertyValueConverter, IPropertyValueConverter, IDiscoverable

    Constructors

    View Source

    RteBlockRenderingValueConverter(HtmlLocalLinkParser, HtmlUrlParser, HtmlImageSourceParser, IApiRichTextElementParser, IApiRichTextMarkupParser, IPartialViewBlockEngine, BlockEditorConverter, IJsonSerializer, IApiElementBuilder, RichTextBlockPropertyValueConstructorCache, ILogger<RteBlockRenderingValueConverter>, IVariationContextAccessor, BlockEditorVarianceHandler, IOptionsMonitor<DeliveryApiSettings>)

    Declaration
    public RteBlockRenderingValueConverter(HtmlLocalLinkParser linkParser, HtmlUrlParser urlParser, HtmlImageSourceParser imageSourceParser, IApiRichTextElementParser apiRichTextElementParser, IApiRichTextMarkupParser apiRichTextMarkupParser, IPartialViewBlockEngine partialViewBlockEngine, BlockEditorConverter blockEditorConverter, IJsonSerializer jsonSerializer, IApiElementBuilder apiElementBuilder, RichTextBlockPropertyValueConstructorCache constructorCache, ILogger<RteBlockRenderingValueConverter> logger, IVariationContextAccessor variationContextAccessor, BlockEditorVarianceHandler blockEditorVarianceHandler, IOptionsMonitor<DeliveryApiSettings> deliveryApiSettingsMonitor)
    Parameters
    Type Name Description
    HtmlLocalLinkParser linkParser
    HtmlUrlParser urlParser
    HtmlImageSourceParser imageSourceParser
    IApiRichTextElementParser apiRichTextElementParser
    IApiRichTextMarkupParser apiRichTextMarkupParser
    IPartialViewBlockEngine partialViewBlockEngine
    BlockEditorConverter blockEditorConverter
    IJsonSerializer jsonSerializer
    IApiElementBuilder apiElementBuilder
    RichTextBlockPropertyValueConstructorCache constructorCache
    ILogger<RteBlockRenderingValueConverter> logger
    IVariationContextAccessor variationContextAccessor
    BlockEditorVarianceHandler blockEditorVarianceHandler
    IOptionsMonitor<DeliveryApiSettings> deliveryApiSettingsMonitor

    Methods

    View Source

    ConvertIntermediateToDeliveryApiObject(IPublishedElement, IPublishedPropertyType, PropertyCacheLevel, object?, bool, bool)

    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.

    object inter

    The intermediate value.

    bool preview

    A value indicating whether conversion should take place in preview mode.

    bool expanding

    A value indicating whether the property value should be expanded (if applicable).

    Returns
    Type Description
    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.

    View Source

    ConvertIntermediateToObject(IPublishedElement, IPublishedPropertyType, PropertyCacheLevel, object?, bool)

    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.

    object inter

    The intermediate value.

    bool preview

    A value indicating whether conversion should take place in preview mode.

    Returns
    Type Description
    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.

    View Source

    ConvertSourceToIntermediate(IPublishedElement, IPublishedPropertyType, object?, bool)

    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.

    object source

    The source value.

    bool preview

    A value indicating whether conversion should take place in preview mode.

    Returns
    Type Description
    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.

    View Source

    Dispose()

    Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

    Declaration
    public void Dispose()
    View Source

    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.

    View Source

    GetDeliveryApiPropertyCacheLevelForExpansion(IPublishedPropertyType)

    Gets the property cache level for Delivery API representation when expanding the property.

    Declaration
    public PropertyCacheLevel GetDeliveryApiPropertyCacheLevelForExpansion(IPublishedPropertyType propertyType)
    Parameters
    Type Name Description
    IPublishedPropertyType propertyType

    The property type.

    Returns
    Type Description
    PropertyCacheLevel

    The property cache level.

    Remarks

    Defaults to the value of GetDeliveryApiPropertyCacheLevel(IPublishedPropertyType).

    View Source

    GetDeliveryApiPropertyValueType(IPublishedPropertyType)

    Gets the type of values returned by the converter for Delivery API representation.

    Declaration
    public Type GetDeliveryApiPropertyValueType(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.

    View Source

    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.

    View Source

    IsValue(object?, PropertyValueLevel)

    Determines whether a value is an actual value, or not a value.

    Declaration
    public override bool? IsValue(object? value, PropertyValueLevel level)
    Parameters
    Type Name Description
    object value
    PropertyValueLevel level
    Returns
    Type Description
    bool?
    Remarks

    Called for Source, Inter and Object levels, until one does not return null.

    Can return true (is a value), false (is not a value), or null to indicate that it cannot be determined at the specified level. For instance, if source is a string that could contain JSON, the decision could be made on the intermediate value. Or, if it is a picker, it could be made on the object value (the actual picked object).

    • Edit this page
    • View Source
    In this article
    Back to top Copyright © 2016-present Umbraco
    Generated by DocFX