Interface IToolbarService
Service on Kit.Toolbar to generate edit toolbars in the front-end.
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
It's especially useful custom and/or complex rules like Metadata-buttons.
History
- uses the Convention: Functional API (Immutable)
- Added in 2sxc 13
- parameter
targetadded toDefault()andEmpty()in v14.03
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
targetobjectoptional entity-like target, see target guide
noParamOrderNoParamOrdertweakFunc<ITweakButton, ITweakButton>Functional Tweak API to modify UI and parameters (new v16.02)
uiobjectoptional configuration how to show, see ui guide
parametersobjectoptional parameters for the command, see parameters guide
prefillobjectoptional prefill for the edit-UI, see prefill guide
Returns
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
targetobjectThe target object which should receive metadata. Must support IHasMetadata
noParamOrderNoParamOrdertweakFunc<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
targetobjectoptional entity-like target, see target guide
noParamOrderNoParamOrdertweakFunc<ITweakButton, ITweakButton>Functional Tweak API to modify UI and parameters (new v16.02)
uiobjectoptional configuration how to show, see ui guide
parametersobjectoptional parameters for the command, see parameters guide
prefillobjectoptional prefill for the edit-UI, see prefill guide
Returns
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
targetobjectThe target object which should receive metadata. Must support IHasMetadata
contentTypesstringName 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)noParamOrderNoParamOrdertweakFunc<ITweakButton, ITweakButton>Functional Tweak API to modify UI and parameters (new v16.02)
uiobjectoptional configuration how to show, see ui guide
parametersobjectoptional parameters for the command, see parameters guide
prefillobjectoptional prefill for the edit-UI, see prefill guide
contextstringEXPERIMENTAL - 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
*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