Search Results for

    Show / Hide Table of Contents
    View Source

    Class BlockEditorDataConverter<TValue, TLayout>

    Converts the block JSON data into objects.

    Inheritance
    object
    Namespace: Umbraco.Cms.Core.Models.Blocks
    Assembly: Umbraco.Core.dll
    Syntax
    public abstract class BlockEditorDataConverter<TValue, TLayout> where TValue : BlockValue<TLayout>, new() where TLayout : IBlockLayoutItem
    Type Parameters
    Name Description
    TValue

    The type of the block value.

    TLayout

    The type of the layout item.

    Constructors

    View Source

    BlockEditorDataConverter(IJsonSerializer)

    Initializes a new instance of the BlockEditorDataConverter<TValue, TLayout> class.

    Declaration
    protected BlockEditorDataConverter(IJsonSerializer jsonSerializer)
    Parameters
    Type Name Description
    IJsonSerializer jsonSerializer

    The JSON serializer.

    Methods

    View Source

    Convert(TValue?)

    Converts the specified block value into block editor data.

    Declaration
    public BlockEditorData<TValue, TLayout> Convert(TValue? value)
    Parameters
    Type Name Description
    TValue value

    The block value to convert.

    Returns
    Type Description
    BlockEditorData<TValue, TLayout>

    The converted block editor data.

    View Source

    Deserialize(string)

    Deserializes the specified JSON into block editor data.

    Declaration
    public BlockEditorData<TValue, TLayout> Deserialize(string json)
    Parameters
    Type Name Description
    string json

    The JSON string to deserialize.

    Returns
    Type Description
    BlockEditorData<TValue, TLayout>

    The deserialized block editor data.

    View Source

    GetBlockReferences(IEnumerable<TLayout>)

    Return the collection of IBlockReference from the block editor's Layout

    Declaration
    protected abstract IEnumerable<ContentAndSettingsReference> GetBlockReferences(IEnumerable<TLayout> layout)
    Parameters
    Type Name Description
    IEnumerable<TLayout> layout
    Returns
    Type Description
    IEnumerable<ContentAndSettingsReference>
    View Source

    TryDeserialize(string, out BlockEditorData<TValue, TLayout>)

    Tries to deserialize the specified JSON into block editor data.

    Declaration
    public bool TryDeserialize(string json, out BlockEditorData<TValue, TLayout> blockEditorData)
    Parameters
    Type Name Description
    string json

    The JSON string to deserialize.

    BlockEditorData<TValue, TLayout> blockEditorData

    When this method returns, contains the block editor data if deserialization succeeded, or null if it failed.

    Returns
    Type Description
    bool

    true if deserialization succeeded; otherwise, false.

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