• Basics
  • Abyss
  • Web APIs
  • C# & Razor
  • .net API
  • JS & TS API

    Show / Hide Table of Contents

    Interface IToolbarService

    Special helper to generate edit toolbars in the front-end. It's especially useful custom and/or complex rules like Metadata-buttons.

    You will typically do something like this:

    var customTlb = Kit.Toolbar.Empty().Edit(Content);
    <div @customTlb>
    </div>
    

    The all the main commands such as Empty(...), Default(...), Metadata(...) will give you a IToolbarBuilder. With this, you can then chain additional commands to create the desired configuration.

    Namespace: ToSic.Sxc.Services
    Assembly: ToSic.Sxc.dll
    Syntax
    [PublicApi]
    public interface IToolbarService
    Remarks

    History

    • Added in 2sxc 13
    • parameter target added to Default() and Empty() in v14.03

    Methods

    | Improve this Doc View Source

    Default(Object, String, Object, Object, Object)

    Build a Toolbar configuration using the default template/buttons to use with @Edit.Toolbar It's a fluid API, so the returned object can be extended with further Add(...) or special helpers to quickly create complex configurations. For guidance what to give it, also check out the toolbar docs.

    Declaration
    IToolbarBuilder Default(object target = null, string noParamOrder = "Rule: All params must be named (https://r.2sxc.org/named-params)", object ui = null, object parameters = null, object prefill = null)
    Parameters
    Type Name Description
    System.Object target

    optional entity-like target, see target guide

    System.String noParamOrder

    see Convention: Named Parameters

    System.Object ui

    optional configuration how to show, see ui guide

    System.Object parameters

    optional parameters for the command, see parameters guide

    System.Object prefill

    optional prefill for the edit-UI, see prefill guide

    Returns
    Type Description
    IToolbarBuilder
    Remarks

    History

    • Added in 2sxc 13
    • target, ui, parameters added in v14.04
    | Improve this Doc View Source

    Empty(Object, String, Object, Object, Object)

    Build a Toolbar configuration using the empty toolbar to use with @Edit.Toolbar It's a fluid API, so the returned object can be extended with further Add(...) or special helpers to quickly create complex configurations. For guidance what to give it, also check out the toolbar docs.

    Declaration
    IToolbarBuilder Empty(object target = null, string noParamOrder = "Rule: All params must be named (https://r.2sxc.org/named-params)", object ui = null, object parameters = null, object prefill = null)
    Parameters
    Type Name Description
    System.Object target

    optional entity-like target, see target guide

    System.String noParamOrder

    see Convention: Named Parameters

    System.Object ui

    optional configuration how to show, see ui guide

    System.Object parameters

    optional parameters for the command, see parameters guide

    System.Object prefill

    optional prefill for the edit-UI, see prefill guide

    Returns
    Type Description
    IToolbarBuilder
    Remarks

    History

    • Added in 2sxc 13
    • target, ui, parameters added in v14.04
    | Improve this Doc View Source

    Metadata(Object, String, String, Object, Object, Object, String)

    Build an empty Toolbar with a Metadata button.

    This is the same as .Empty().Metadata(target, contentType);

    Declaration
    IToolbarBuilder Metadata(object target, string contentTypes = null, string noParamOrder = "Rule: All params must be named (https://r.2sxc.org/named-params)", object ui = null, object parameters = null, object prefill = null, string context = null)
    Parameters
    Type Name Description
    System.Object target

    The target object which should receive metadata. Must support IHasMetadata

    System.String contentTypes

    Name of one or more content-types for which to generate the button(s). For many, use comma , to separate. If not specified, will try to lookup config (v14)

    System.String noParamOrder

    see Convention: Named Parameters

    System.Object ui

    optional configuration how to show, see ui guide

    System.Object parameters

    optional parameters for the command, see parameters guide

    System.Object prefill

    optional prefill for the edit-UI, see prefill guide

    System.String context

    EXPERIMENTAL - not final

    Returns
    Type Description
    IToolbarBuilder

    An toolbar builder with empty configuration and just this button on it

    Remarks

    History

    • Added in 2sxc 13
    • contentTypes changed from one to many in v14
    • contentTypes can also have * or YourCustomType,* in v14
    • contentTypes can also be optional, in which case it behaves as if it was * in v14 - if no config is found, it will not add a metadata-button
    • parameter context added in 2sxc 14 - still WIP/experimental
    • Improve this Doc
    • View Source
    Back to top Generated by DocFX