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
- uses the Convention: Functional API (Immutable)
- Added in 2sxc 13
- parameter
target
added toDefault()
andEmpty()
in v14.03
Methods
| Improve this Doc View SourceDefault(object, string, 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.
Declaration
IToolbarBuilder Default(object target = null, string noParamOrder = "Params must be named (https://go.2sxc.org/named-params)", Func<ITweakButton, ITweakButton> tweak = null, object ui = null, object parameters = null, object prefill = null)
Parameters
Type | Name | Description |
---|---|---|
object | target | optional entity-like target, see target guide |
string | noParamOrder | |
Func<ITweakButton, ITweakButton> | tweak | Functional Tweak API to modify UI and parameters (new v16.02) |
object | ui | optional configuration how to show, see ui guide |
object | parameters | optional parameters for the command, see parameters guide |
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
- root added in 16.02
Empty(object, string, 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.
Declaration
IToolbarBuilder Empty(object target = null, string noParamOrder = "Params must be named (https://go.2sxc.org/named-params)", Func<ITweakButton, ITweakButton> tweak = null, object ui = null, object parameters = null, object prefill = null)
Parameters
Type | Name | Description |
---|---|---|
object | target | optional entity-like target, see target guide |
string | noParamOrder | |
Func<ITweakButton, ITweakButton> | tweak | Functional Tweak API to modify UI and parameters (new v16.02) |
object | ui | optional configuration how to show, see ui guide |
object | parameters | optional parameters for the command, see parameters guide |
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
- root added in 16.02
Metadata(object, string, string, Func<ITweakButton, ITweakButton>, 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 = "Params must be named (https://go.2sxc.org/named-params)", Func<ITweakButton, ITweakButton> tweak = null, object ui = null, object parameters = null, object prefill = null, string context = null)
Parameters
Type | Name | Description |
---|---|---|
object | target | The target object which should receive metadata. Must support IHasMetadata |
string | contentTypes | Name of one or more content-types for which to generate the button(s). For many, use comma |
string | noParamOrder | |
Func<ITweakButton, ITweakButton> | tweak | Functional Tweak API to modify UI and parameters (new v16.02) |
object | ui | optional configuration how to show, see ui guide |
object | parameters | optional parameters for the command, see parameters guide |
object | prefill | optional prefill for the edit-UI, see prefill guide |
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
*
orYourCustomType,*
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
- root added in 16.02