Search Results for

    Show / Hide Table of Contents
    View Source

    Class BlockEditorConverter

    Converts JSON block objects into IPublishedElement.

    Inheritance
    object
    Namespace: Umbraco.Cms.Core.PropertyEditors.ValueConverters
    Assembly: Umbraco.Infrastructure.dll
    Syntax
    public sealed class BlockEditorConverter

    Constructors

    View Source

    BlockEditorConverter(IPublishedContentTypeCache, ICacheManager, IPublishedModelFactory, IVariationContextAccessor, BlockEditorVarianceHandler)

    Initializes a new instance of the BlockEditorConverter class.

    Declaration
    public BlockEditorConverter(IPublishedContentTypeCache publishedContentTypeCache, ICacheManager cacheManager, IPublishedModelFactory publishedModelFactory, IVariationContextAccessor variationContextAccessor, BlockEditorVarianceHandler blockEditorVarianceHandler)
    Parameters
    Type Name Description
    IPublishedContentTypeCache publishedContentTypeCache

    Provides access to cached published content types for efficient lookup.

    ICacheManager cacheManager

    Manages caching for property editor values and related data.

    IPublishedModelFactory publishedModelFactory

    Factory for creating strongly typed published content models.

    IVariationContextAccessor variationContextAccessor

    Accessor for the current variation context, used for culture and segment variations.

    BlockEditorVarianceHandler blockEditorVarianceHandler

    Handles variance logic specific to block editor properties.

    Methods

    View Source

    ConvertToElement(IPublishedElement, BlockItemData, PropertyCacheLevel, bool)

    Converts a BlockItemData instance into an IPublishedElement for use in the block editor.

    Declaration
    public IPublishedElement? ConvertToElement(IPublishedElement owner, BlockItemData data, PropertyCacheLevel referenceCacheLevel, bool preview)
    Parameters
    Type Name Description
    IPublishedElement owner

    The parent IPublishedElement that owns the block element, used for context such as culture and segment variations.

    BlockItemData data

    The BlockItemData representing the block to convert.

    PropertyCacheLevel referenceCacheLevel

    The PropertyCacheLevel to use for resolving references during conversion.

    bool preview

    If true, conversion is performed in preview mode; otherwise, in published mode.

    Returns
    Type Description
    IPublishedElement

    An IPublishedElement representing the converted block if the conversion is successful and the data is valid; otherwise, null if the content type is not found, is not an element type, or the key is missing or invalid.

    View Source

    GetModelType(Guid)

    Returns the model System.Type associated with the specified content type key. If the content type key does not correspond to an element type, returns IPublishedElement.

    Declaration
    public Type GetModelType(Guid contentTypeKey)
    Parameters
    Type Name Description
    Guid contentTypeKey

    The unique key identifying the content type.

    Returns
    Type Description
    Type

    The model System.Type for the content type key, or IPublishedElement if not found or not an element.

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