Table of Contents

Interface IToolbarService

Namespace
ToSic.Sxc.Services
Assembly
ToSic.Sxc.dll

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.

[PublicApi]
public interface IToolbarService

Remarks

History

Methods

Default(object, NoParamOrder, Func<ITweakButton, ITweakButton>, 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.

IToolbarBuilder Default(object target = null, NoParamOrder noParamOrder = default, Func<ITweakButton, ITweakButton> tweak = null, object ui = null, object parameters = null, object prefill = null)

Parameters

target object

optional entity-like target, see target guide

noParamOrder NoParamOrder

see Convention: Named Parameters

tweak Func<ITweakButton, ITweakButton>

Functional Tweak API to modify UI and parameters (new v16.02)

ui object

optional configuration how to show, see ui guide

parameters object

optional parameters for the command, see parameters guide

prefill object

optional prefill for the edit-UI, see prefill guide

Returns

IToolbarBuilder

Remarks

History

  • Added in 2sxc 13
  • target, ui, parameters added in v14.04

Edit(object, NoParamOrder, Func<ITweakButton, ITweakButton>)

Build an empty Toolbar with a Edit button.

This is the same as .Empty().Edit(...)

IToolbarBuilder Edit(object target, NoParamOrder noParamOrder = default, Func<ITweakButton, ITweakButton> tweak = null)

Parameters

target object

The target object which should receive metadata. Must support IHasMetadata

noParamOrder NoParamOrder

see Convention: Named Parameters

tweak Func<ITweakButton, ITweakButton>

Functional Tweak API to modify UI and parameters (new v16.02)

Returns

IToolbarBuilder

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

Remarks

History

  • Added in 2sxc 17

Empty(object, NoParamOrder, Func<ITweakButton, ITweakButton>, 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.

IToolbarBuilder Empty(object target = null, NoParamOrder noParamOrder = default, Func<ITweakButton, ITweakButton> tweak = null, object ui = null, object parameters = null, object prefill = null)

Parameters

target object

optional entity-like target, see target guide

noParamOrder NoParamOrder

see Convention: Named Parameters

tweak Func<ITweakButton, ITweakButton>

Functional Tweak API to modify UI and parameters (new v16.02)

ui object

optional configuration how to show, see ui guide

parameters object

optional parameters for the command, see parameters guide

prefill object

optional prefill for the edit-UI, see prefill guide

Returns

IToolbarBuilder

Remarks

History

  • Added in 2sxc 13
  • target, ui, parameters added in v14.04

Metadata(object, string, NoParamOrder, Func<ITweakButton, ITweakButton>, object, object, object, string)

Build an empty Toolbar with a Metadata button.

This is the same as .Empty().Metadata(...)

IToolbarBuilder Metadata(object target, string contentTypes = null, NoParamOrder noParamOrder = default, Func<ITweakButton, ITweakButton> tweak = null, object ui = null, object parameters = null, object prefill = null, string context = null)

Parameters

target object

The target object which should receive metadata. Must support IHasMetadata

contentTypes string

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)

noParamOrder NoParamOrder

see Convention: Named Parameters

tweak Func<ITweakButton, ITweakButton>

Functional Tweak API to modify UI and parameters (new v16.02)

ui object

optional configuration how to show, see ui guide

parameters object

optional parameters for the command, see parameters guide

prefill object

optional prefill for the edit-UI, see prefill guide

context string

EXPERIMENTAL - not final

Returns

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