Table of Contents

Interface IToolbarBuilder

Namespace
ToSic.Sxc.Edit.Toolbar
Assembly
ToSic.Sxc.dll

The toolbar builder helps you create Toolbar configurations for the UI. Note that it has a fluid API, and each method/use returns a fresh object with the updated configuration.

[PublicApi]
public interface IToolbarBuilder : IHasLog
Inherited Members

Remarks

Your code cannot construct this object by itself, as it usually needs additional information. To get a ToolbarBuilder, use the IToolbarService.

History

  • Added in 2sxc 13, just minimal API
  • massively enhanced in v14.04
  • most commands extended with Tweak API in v15.07

Methods

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

Create button to add a new entity to a list of entities. Can also be used to remove the same button on a toolbar which would have it by default.

IToolbarBuilder Add(object target = null, NoParamOrder noParamOrder = default, string contentType = null, Func<ITweakButton, ITweakButton> tweak = null, object ui = null, object parameters = null, string operation = null)

Parameters

target object

optional entity-like target which is in a list of items in on a content-block, see target guide

noParamOrder NoParamOrder

see Convention: Named Parameters

contentType string
tweak Func<ITweakButton, ITweakButton>

Functional Tweak API to modify UI and parameters

ui object

optional configuration how to show, see ui guide

parameters object

optional parameters for the command, see parameters guide

operation string

optional change what should happen

Returns

IToolbarBuilder

a new toolbar builder - see guide

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

Create button to add an existing entity to the list. Can also be used to remove the same button on a toolbar which would have it by default.

IToolbarBuilder AddExisting(object target = null, NoParamOrder noParamOrder = default, string contentType = null, Func<ITweakButton, ITweakButton> tweak = null, object ui = null, object parameters = null, string operation = null)

Parameters

target object

optional entity-like target which is in a list of items in on a content-block, see target guide

noParamOrder NoParamOrder

see Convention: Named Parameters

contentType string
tweak Func<ITweakButton, ITweakButton>

Functional Tweak API to modify UI and parameters

ui object

optional configuration how to show, see ui guide

parameters object

optional parameters for the command, see parameters guide

operation string

optional change what should happen

Returns

IToolbarBuilder

a new toolbar builder - see guide

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

Create button to admin the app. Can also be used to remove the same button on a toolbar which would have it by default.

IToolbarBuilder App(object target = null, NoParamOrder noParamOrder = default, Func<ITweakButton, ITweakButton> tweak = null, object ui = null, object parameters = null, string operation = null)

Parameters

target object

not used ATM just here for API consistency

noParamOrder NoParamOrder

see Convention: Named Parameters

tweak Func<ITweakButton, ITweakButton>

Functional Tweak API to modify UI and parameters

ui object

optional configuration how to show, see ui guide

parameters object

optional parameters for the command, see parameters guide

operation string

optional change what should happen. By default, the button will show based on conditions like permissions.

Returns

IToolbarBuilder

a new toolbar builder - see guide

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

Create button to open the import-app dialog. Can also be used to remove the same button on a toolbar which would have it by default.

IToolbarBuilder AppImport(object target = null, NoParamOrder noParamOrder = default, Func<ITweakButton, ITweakButton> tweak = null, object ui = null, object parameters = null, string operation = null)

Parameters

target object

not used ATM just here for API consistency

noParamOrder NoParamOrder

see Convention: Named Parameters

tweak Func<ITweakButton, ITweakButton>

Functional Tweak API to modify UI and parameters

ui object

optional configuration how to show, see ui guide

parameters object

optional parameters for the command, see parameters guide

operation string

optional change what should happen. By default, the button will show based on conditions like permissions.

Returns

IToolbarBuilder

a new toolbar builder - see guide

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

Create button to edit the app resources if there are any. Can also be used to remove the same button on a toolbar which would have it by default.

IToolbarBuilder AppResources(object target = null, NoParamOrder noParamOrder = default, Func<ITweakButton, ITweakButton> tweak = null, object ui = null, object parameters = null, string operation = null)

Parameters

target object

not used ATM just here for API consistency

noParamOrder NoParamOrder

see Convention: Named Parameters

tweak Func<ITweakButton, ITweakButton>

Functional Tweak API to modify UI and parameters

ui object

optional configuration how to show, see ui guide

parameters object

optional parameters for the command, see parameters guide

operation string

optional change what should happen. By default, the button will show based on conditions like permissions.

Returns

IToolbarBuilder

a new toolbar builder - see guide

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

Create button to edit the custom app settings if there are any. Can also be used to remove the same button on a toolbar which would have it by default.

IToolbarBuilder AppSettings(object target = null, NoParamOrder noParamOrder = default, Func<ITweakButton, ITweakButton> tweak = null, object ui = null, object parameters = null, string operation = null)

Parameters

target object

not used ATM just here for API consistency

noParamOrder NoParamOrder

see Convention: Named Parameters

tweak Func<ITweakButton, ITweakButton>

Functional Tweak API to modify UI and parameters

ui object

optional configuration how to show, see ui guide

parameters object

optional parameters for the command, see parameters guide

operation string

optional change what should happen. By default, the button will show based on conditions like permissions.

Returns

IToolbarBuilder

a new toolbar builder - see guide

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

Create button to open the apps management of the current site. Can also be used to remove the same button on a toolbar which would have it by default.

IToolbarBuilder Apps(object target = null, NoParamOrder noParamOrder = default, Func<ITweakButton, ITweakButton> tweak = null, object ui = null, object parameters = null, string operation = null)

Parameters

target object

not used ATM just here for API consistency

noParamOrder NoParamOrder

see Convention: Named Parameters

tweak Func<ITweakButton, ITweakButton>

Functional Tweak API to modify UI and parameters

ui object

optional configuration how to show, see ui guide

parameters object

optional parameters for the command, see parameters guide

operation string

optional change what should happen. By default, the button will show based on conditions like permissions.

Returns

IToolbarBuilder

a new toolbar builder - see guide

AsAttributes(object)

Get a toolbar builder which would render to HTML as attributes on an existing tag. Note that this is the default, so you will usually not need this.

IToolbarBuilder AsAttributes(object target = null)

Parameters

target object

optional entity-like target, see target guide

Returns

IToolbarBuilder

a new toolbar builder - see guide

AsTag(object)

Get a toolbar builder which would render to HTML as a standalone tag.

Important: Toolbars created using this will behave differently from previous standalone toolbars. These standalone toolbars will not float automatically as previous ones did. You can still get them to float by adjusting the Settings as you need them.

This is because many years ago, standalone toolbars were configured floated automatically. As the APIs got better, this wasn't a great default any more, but we couldn't introduce a breaking change. Anything created now with this new API will be new, so this will behave more in line with expectations. See also issue

IToolbarBuilder AsTag(object target = null)

Parameters

target object

optional entity-like target, see target guide

Returns

IToolbarBuilder

a new toolbar builder - see guide

Audience(NoParamOrder, bool?)

Specify an audience for the toolbar. Normally only people with admin permissions would see a toolbar. Specifying the audience will make it appear even if you are not an admin.

Reasons for this would be to have some special buttons for a certain group of users.

IToolbarBuilder Audience(NoParamOrder protector = default, bool? everyone = null)

Parameters

protector NoParamOrder

see Convention: Named Parameters

everyone bool?

default is null, set to true to make everybody see this.

Returns

IToolbarBuilder

Remarks

New in v17.08, for now should be regarded as experimental. Naming might still change.

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

Add a custom button / command. Can also be used to do advanced remove operations or modify a button on a toolbar which would have it by default.

IToolbarBuilder Button(string name, object target = null, NoParamOrder noParamOrder = default, Func<ITweakButton, ITweakButton> tweak = null, object ui = null, object parameters = null, string operation = null, string context = null)

Parameters

name string
  1. The required name of the command. See CommandNames.

  2. Can also be a full rule-string containing parameters and more according to the conventions of the js toolbar

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

ui object

optional configuration how to show, see ui guide

parameters object

optional parameters for the command, see parameters guide

operation string

optional change what should happen

context string

Returns

IToolbarBuilder

a new toolbar builder - see guide

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

Create Button to run JS code. Can also be used to remove the same button on a toolbar which would have it by default.

IToolbarBuilder Code(object target, NoParamOrder noParamOrder = default, Func<ITweakButton, ITweakButton> tweak = null, object ui = null, object parameters = null, string operation = null)

Parameters

target object

Name of the function to call, without parameters.

noParamOrder NoParamOrder

see Convention: Named Parameters

tweak Func<ITweakButton, ITweakButton>

Functional Tweak API to modify UI and parameters

ui object

optional configuration how to show, see ui guide

parameters object

optional parameters for the command, see parameters guide

operation string

optional change what should happen

Returns

IToolbarBuilder

a new toolbar builder - see guide

Condition(bool)

Condition to apply if the toolbar would show, but maybe shouldn't. For example, you can prevent the toolbar from appearing if it's the Demo-Item.

For expensive conditions, use the overload which accepts a function.

IToolbarBuilder Condition(bool condition)

Parameters

condition bool

true/false

Returns

IToolbarBuilder

a new toolbar builder - see guide

Remarks

New in v14.04

Condition(Func<bool>)

Condition to apply if the toolbar would show, but maybe shouldn't. For example, you can prevent the toolbar from appearing if it's the Demo-Item.

This accepts a function to check the condition. It will only run if the toolbar would already show.

IToolbarBuilder Condition(Func<bool> condition)

Parameters

condition Func<bool>

function such as () => true

Returns

IToolbarBuilder

a new toolbar builder - see guide

Remarks

New in v14.04

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

Create button to copy an item. Can also be used to remove the same button on a toolbar which would have it by default. It needs the item which it will copy as a parameter.

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

Parameters

target object
  • an entity-like target, see target guide
  • can also be a int (number) entityId. If you only supply the entity ID, you must also supply the contentType.
noParamOrder NoParamOrder

see Convention: Named Parameters

tweak Func<ITweakButton, ITweakButton>

Functional Tweak API to modify UI and parameters

contentType string
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

operation string

optional change what should happen

context string

EXPERIMENTAL - not final

Returns

IToolbarBuilder

A new toolbar builder which has been extended with this button

Remarks

Added in v14.02

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

Create button to show a data-admin dialog with all the data-items / entities of a specific content type. Can also be used to remove the same button on a toolbar which would have it by default.

IToolbarBuilder Data(object target = null, NoParamOrder noParamOrder = default, Func<ITweakButton, ITweakButton> tweak = null, object filter = null, object ui = null, object parameters = null, string operation = null)

Parameters

target object

3 Options:

  • an entity-like target, see target guide
  • a string containing the type name
  • a modifier keyword such as remove or - to remove the button
noParamOrder NoParamOrder

see Convention: Named Parameters

tweak Func<ITweakButton, ITweakButton>

Functional Tweak API to modify UI and parameters

filter object

object or string with the filters for the data view see filter

ui object

optional configuration how to show, see ui guide

parameters object

optional parameters for the command, see parameters guide

operation string

optional change what should happen

Returns

IToolbarBuilder

a new toolbar builder - see guide

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

Create (or reconfigure) the button to delete an item.

This has a special behavior. The default toolbar already includes a delete-button in the third group. So if the toolbar is is a default this will just modify it to force-show. But it will still be in the third group of buttons.

For the empty toolbar it will just add the button in the normal way.

To change this automatic behavior, use a operation = modify or add

IToolbarBuilder Delete(object target = null, NoParamOrder noParamOrder = default, Func<ITweakButton, ITweakButton> tweak = null, object ui = null, object parameters = null, string operation = 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

ui object

optional configuration how to show, see ui guide

parameters object

optional parameters for the command, see parameters guide

operation string

optional change what should happen

Returns

IToolbarBuilder

a new toolbar builder - see guide

DetectDemo(ICanBeEntity, NoParamOrder, string)

Detect if the toolbar should go into demo-mode.

[InternalApi_DoNotUse_MayChangeWithoutNotice("WIP 16.02")]
IToolbarBuilder DetectDemo(ICanBeEntity root, NoParamOrder noParamOrder = default, string message = null)

Parameters

root ICanBeEntity
noParamOrder NoParamOrder

see Convention: Named Parameters

message string

Optional message or a resources key such as Resources.ToolbarShowingDemo

Returns

IToolbarBuilder

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

Create button to edit an item. Can also be used to remove the same button on a toolbar which would have it by default.

IToolbarBuilder Edit(object target = null, NoParamOrder noParamOrder = default, Func<ITweakButton, ITweakButton> tweak = null, object ui = null, object parameters = null, object prefill = null, string operation = 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

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

operation string

optional change what should happen

Returns

IToolbarBuilder

a new toolbar builder - see guide

Edition(NoParamOrder, string, Func<ITweakButton, ITweakButton>)

Create Button to let the user switch to other app editions.

Note that by default, this functionality is also on the Layout button, but there are cases where a user won't see that (like a non-admin) and you may still want to provide them this feature.

IToolbarBuilder Edition(NoParamOrder noParamOrder = default, string editions = null, Func<ITweakButton, ITweakButton> tweak = null)

Parameters

noParamOrder NoParamOrder

see Convention: Named Parameters

editions string

Optional list of editions, like staging,live. By default, it would take the editions in the app.json.

tweak Func<ITweakButton, ITweakButton>

Functional Tweak API to modify UI and parameters

Returns

IToolbarBuilder

a new toolbar builder - see guide

Remarks

new v17.08, should be considered experimental ATM

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

Create Button to open a dialog to manage the fields/attributes of the content type. Can also be used to remove the same button on a toolbar which would have it by default.

IToolbarBuilder Fields(object target = null, NoParamOrder noParamOrder = default, Func<ITweakButton, ITweakButton> tweak = null, object ui = null, object parameters = null, string operation = null)

Parameters

target object
noParamOrder NoParamOrder

see Convention: Named Parameters

tweak Func<ITweakButton, ITweakButton>

Functional Tweak API to modify UI and parameters

ui object

optional configuration how to show, see ui guide

parameters object

optional parameters for the command, see parameters guide

operation string

optional change what should happen

Returns

IToolbarBuilder

a new toolbar builder - see guide

For(object)

Set the main target of this toolbar.

IToolbarBuilder For(object target)

Parameters

target object

optional entity-like target, see target guide

Returns

IToolbarBuilder

a new toolbar builder - see guide

Remarks

New in v14.04

Group(string)

Adds a button group to the toolbar. All following buttons will be in this group automatically.

Can also be used to remove a group of buttons on the default toolbar, such as the group view. See list of groups on default

IToolbarBuilder Group(string name = null)

Parameters

name string

optional - name of new group or -name to remove an existing group.

Returns

IToolbarBuilder

Remarks

New in v14.08

Info(NoParamOrder, string, string, Func<ITweakButton, ITweakButton>)

Create an info, warning, help or link-button to assist the user.

IToolbarBuilder Info(NoParamOrder noParamOrder = default, string link = null, string target = null, Func<ITweakButton, ITweakButton> tweak = null)

Parameters

noParamOrder NoParamOrder

see Convention: Named Parameters

link string

If provided, will make the button open the link in a new window.

target string

the target window, like _blank - new in v17; defaults to null so that ctrl-click etc. work as expected

tweak Func<ITweakButton, ITweakButton>

Optional function call to tweak the button.

Returns

IToolbarBuilder

Remarks

  • Added in v15.07
  • target added in v17 - defaults to nothing, so if you explicitly want a new window, you must set it to _blank

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

Create button to open the insights for debugging. Can also be used to remove the same button on a toolbar which would have it by default.

IToolbarBuilder Insights(object target = null, NoParamOrder noParamOrder = default, Func<ITweakButton, ITweakButton> tweak = null, object ui = null, object parameters = null, string operation = null)

Parameters

target object

not used ATM just here for API consistency

noParamOrder NoParamOrder

see Convention: Named Parameters

tweak Func<ITweakButton, ITweakButton>

Functional Tweak API to modify UI and parameters

ui object

optional configuration how to show, see ui guide

parameters object

optional parameters for the command, see parameters guide

operation string

optional change what should happen. By default, the button will show based on conditions like permissions.

Returns

IToolbarBuilder

a new toolbar builder - see guide

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

Create Button to change the view/layout of the data shown on the page. Can also be used to remove the same button on a toolbar which would have it by default.

IToolbarBuilder Layout(object target = null, NoParamOrder noParamOrder = default, Func<ITweakButton, ITweakButton> tweak = null, object ui = null, object parameters = null, string operation = null)

Parameters

target object

not used ATM just here for API consistency

noParamOrder NoParamOrder

see Convention: Named Parameters

tweak Func<ITweakButton, ITweakButton>

Functional Tweak API to modify UI and parameters

ui object

optional configuration how to show, see ui guide

parameters object

optional parameters for the command, see parameters guide

operation string

optional change what should happen

Returns

IToolbarBuilder

a new toolbar builder - see guide

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

Create button to manage the list of entities shown here. Can also be used to remove the same button on a toolbar which would have it by default.

IToolbarBuilder List(object target = null, NoParamOrder noParamOrder = default, Func<ITweakButton, ITweakButton> tweak = null, object ui = null, object parameters = null, string operation = null)

Parameters

target object

optional entity-like target which is in a list of items in on a content-block, see target guide

noParamOrder NoParamOrder

see Convention: Named Parameters

tweak Func<ITweakButton, ITweakButton>

Functional Tweak API to modify UI and parameters

ui object

optional configuration how to show, see ui guide

parameters object

optional parameters for the command, see parameters guide

operation string

optional change what should happen

Returns

IToolbarBuilder

a new toolbar builder - see guide

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

Create button to add or edit metadata to the specified object and using the content-type specified here. Can also be used to remove the same button on a toolbar which would have it by default.

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 operation = null, string context = null)

Parameters

target object

The target object which should receive metadata. Must support IHasMetadata. Often an entity-like target, see target guide, but can also other metadata supporting objects, like an Asset, Page, Site, etc.

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

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

operation string

optional change what should happen

context string

EXPERIMENTAL - not final

Returns

IToolbarBuilder

A new toolbar builder which has been extended with this button

Remarks

History

  • Added in 2sxc 13
  • contentTypes changed from one to many in v14
  • contentTypes can also have * or SomeType,* 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
  • changed ui and parameters to support object in v14.04

More(NoParamOrder, object)

Add a more button. Not really useful to do, but included for completeness

IToolbarBuilder More(NoParamOrder noParamOrder = default, object ui = null)

Parameters

noParamOrder NoParamOrder

see Convention: Named Parameters

ui object

optional configuration how to show, see ui guide

Returns

IToolbarBuilder

a new toolbar builder - see guide

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

Create button to move an item down in a list. Can also be used to remove the same button on a toolbar which would have it by default.

IToolbarBuilder MoveDown(object target = null, NoParamOrder noParamOrder = default, Func<ITweakButton, ITweakButton> tweak = null, object ui = null, object parameters = null, string operation = null)

Parameters

target object

optional entity-like target which is in a list of items in on a content-block, see target guide

noParamOrder NoParamOrder

see Convention: Named Parameters

tweak Func<ITweakButton, ITweakButton>

Functional Tweak API to modify UI and parameters

ui object

optional configuration how to show, see ui guide

parameters object

optional parameters for the command, see parameters guide

operation string

optional change what should happen

Returns

IToolbarBuilder

a new toolbar builder - see guide

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

Create button to move an item up in a list. Can also be used to remove the same button on a toolbar which would have it by default.

IToolbarBuilder MoveUp(object target = null, NoParamOrder noParamOrder = default, Func<ITweakButton, ITweakButton> tweak = null, object ui = null, object parameters = null, string operation = null)

Parameters

target object

optional entity-like target which is in a list of items in on a content-block, see target guide

noParamOrder NoParamOrder

see Convention: Named Parameters

tweak Func<ITweakButton, ITweakButton>

Functional Tweak API to modify UI and parameters

ui object

optional configuration how to show, see ui guide

parameters object

optional parameters for the command, see parameters guide

operation string

optional change what should happen

Returns

IToolbarBuilder

a new toolbar builder - see guide

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

Create button to create a new item. Can also be used to remove the same button on a toolbar which would have it by default.

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

Parameters

target object

X Options

  • an entity-like target, see target guide
  • a string with the content-type name
noParamOrder NoParamOrder

see Convention: Named Parameters

tweak Func<ITweakButton, ITweakButton>

Functional Tweak API to modify UI and parameters

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

operation string

optional change what should happen

Returns

IToolbarBuilder

a new toolbar builder - see guide

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

Adds / updates the params rule on the toolbar which contains information for all the buttons

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

Parameters

target object

Many options

  1. An Entity-like thing which would be used to prepare default params like entityId
  2. A string, which would be the same as using the term on the parameters
  3. A object - especially an anonymous object like new { id = 7, show = true }
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

Returns

IToolbarBuilder

a new toolbar builder - see guide

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

Create button to publish the current item. Can also be used to remove the same button on a toolbar which would have it by default. By default it will only appear if the current item is draft/unpublished. You can change this (but probably shouldn't) by setting an operation.

IToolbarBuilder Publish(object target = null, NoParamOrder noParamOrder = default, Func<ITweakButton, ITweakButton> tweak = null, object ui = null, object parameters = null, string operation = 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

ui object

optional configuration how to show, see ui guide

parameters object

optional parameters for the command, see parameters guide

operation string

optional change what should happen

Returns

IToolbarBuilder

a new toolbar builder - see guide

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

Create Button to open the design/edit query dialog. Can also be used to remove the same button on a toolbar which would have it by default.

IToolbarBuilder Query(object target = null, NoParamOrder noParamOrder = default, Func<ITweakButton, ITweakButton> tweak = null, object ui = null, object parameters = null, string operation = null)

Parameters

target object
noParamOrder NoParamOrder

see Convention: Named Parameters

tweak Func<ITweakButton, ITweakButton>

Functional Tweak API to modify UI and parameters

ui object

optional configuration how to show, see ui guide

parameters object

optional parameters for the command, see parameters guide

operation string

optional change what should happen

Returns

IToolbarBuilder

a new toolbar builder - see guide

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

Create button to remove an item from a list. Can also be used to remove the same button on a toolbar which would have it by default. This will not delete the item, just remove.

IToolbarBuilder Remove(object target = null, NoParamOrder noParamOrder = default, Func<ITweakButton, ITweakButton> tweak = null, object ui = null, object parameters = null, string operation = null)

Parameters

target object

optional entity-like target which is in a list of items in on a content-block, see target guide

noParamOrder NoParamOrder

see Convention: Named Parameters

tweak Func<ITweakButton, ITweakButton>

Functional Tweak API to modify UI and parameters

ui object

optional configuration how to show, see ui guide

parameters object

optional parameters for the command, see parameters guide

operation string

optional change what should happen

Returns

IToolbarBuilder

a new toolbar builder - see guide

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

Create button to replace the current item in the list with another existing item. Can also be used to remove the same button on a toolbar which would have it by default.

IToolbarBuilder Replace(object target = null, NoParamOrder noParamOrder = default, Func<ITweakButton, ITweakButton> tweak = null, object ui = null, object parameters = null, string operation = null)

Parameters

target object

optional entity-like target which is in a list of items in on a content-block, see target guide

noParamOrder NoParamOrder

see Convention: Named Parameters

tweak Func<ITweakButton, ITweakButton>

Functional Tweak API to modify UI and parameters

ui object

optional configuration how to show, see ui guide

parameters object

optional parameters for the command, see parameters guide

operation string

optional change what should happen

Returns

IToolbarBuilder

a new toolbar builder - see guide

Settings(NoParamOrder, string, string, string, string, string, object, object)

Add a settings rule to configure what the toolbar should look like. See Toolbar Settings

IToolbarBuilder Settings(NoParamOrder noParamOrder = default, string show = null, string hover = null, string follow = null, string classes = null, string autoAddMore = null, object ui = null, object parameters = null)

Parameters

noParamOrder NoParamOrder

see Convention: Named Parameters

show string

hover (default), always

hover string

right (default), left

follow string
classes string

css class names to add to the entire toolbar

autoAddMore string

placement of the more ellipsis button, auto (default), end, start, never

ui object

optional configuration how to show, see ui guide

parameters object

Parameters for the command - doesn't really have an effect on Settings, but included for consistency

Returns

IToolbarBuilder

a new toolbar builder - see guide

Remarks

History

  • Added in 2sxc 13
  • options auto and never on autoAddMore added in 14.08

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

Create button to open the system admin dialog. Can also be used to remove the same button on a toolbar which would have it by default.

IToolbarBuilder System(object target = null, NoParamOrder noParamOrder = default, Func<ITweakButton, ITweakButton> tweak = null, object ui = null, object parameters = null, string operation = null)

Parameters

target object

not used ATM just here for API consistency

noParamOrder NoParamOrder

see Convention: Named Parameters

tweak Func<ITweakButton, ITweakButton>

Functional Tweak API to modify UI and parameters

ui object

optional configuration how to show, see ui guide

parameters object

optional parameters for the command, see parameters guide

operation string

optional change what should happen. By default, the button will show based on conditions like permissions.

Returns

IToolbarBuilder

a new toolbar builder - see guide

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

Create Button to open the edit-template (source-code) dialog. Can also be used to remove the same button on a toolbar which would have it by default.

IToolbarBuilder Template(object target = null, NoParamOrder noParamOrder = default, Func<ITweakButton, ITweakButton> tweak = null, object ui = null, object parameters = null, string operation = null)

Parameters

target object
noParamOrder NoParamOrder

see Convention: Named Parameters

tweak Func<ITweakButton, ITweakButton>

Functional Tweak API to modify UI and parameters

ui object

optional configuration how to show, see ui guide

parameters object

optional parameters for the command, see parameters guide

operation string

optional change what should happen

Returns

IToolbarBuilder

a new toolbar builder - see guide

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

Create Button to open the edit view settings dialog. Can also be used to remove the same button on a toolbar which would have it by default.

IToolbarBuilder View(object target = null, NoParamOrder noParamOrder = default, Func<ITweakButton, ITweakButton> tweak = null, object ui = null, object parameters = null, string operation = null)

Parameters

target object
noParamOrder NoParamOrder

see Convention: Named Parameters

tweak Func<ITweakButton, ITweakButton>

Functional Tweak API to modify UI and parameters

ui object

optional configuration how to show, see ui guide

parameters object

optional parameters for the command, see parameters guide

operation string

optional change what should happen

Returns

IToolbarBuilder

a new toolbar builder - see guide