Availability: >= 3.0

Type: Object Method

Description: Adds a registered button to the toolbar layout.


$editor->addRegisteredButtonstring $buttonidstring $location );


This should be the ID of a registered button to add. The value can represent any toolbar item including menus and separators. See Button and Feature Identifiers

To register a new custom button see the registerButton, registerMenuButton, registerSelect, and registerSpacer methods.

A string representing the location to place the button in the toolbar layout. The value should be a location keyword followed by an optional colon ':' and the ID name of a button or toolbar to position relative to. Each toolbar has an ID, in the default layout there are two toolbars named 'toolbar1' and 'toolbar2'. If you do not know the ID names of the current toolbars you can use a numeric reference instead where 0 is the first toolbar, 1 is the second toolbar etc.

Valid location keywords are: after, before, start and end.

For example the value 'before:paste' would place the button before the paste button. A value of 'after:paste' would place it after the paste button. A value of 'start:toolbar1' would place it as the first item in toolbar1 and a value of 'end:toolbar1' would place it as the last button in the toolbar1. A value of 'start' would place it at the beginning of the first toolbar and a value of 'end' would place it at the end of the last toolbar.


The following would add the Strikethrough button after the underline button:


See also:

toolbarLayout, clearToolbarLayout, addToolbar, removeToolbar, disableFeature