Availability: >= 3.0

Type: Object Method

Description: Adds a registered button to the context menu.


$editor->addContextMenuItemstring $buttonidstring $location );


This should be the ID of a registered button to add. See Button and Feature Identifiers
Only buttons and separators can be added to the context menu.

To register a new custom button see the registerButton method.

A string representing the location to place the button on the menu. The value should be a location keyword followed by an optional colon ':' and the ID name of a button to position relative to.

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' would place it as the first item in the menu and a value of 'end' would make it the last button in the menu.

Note: only buttons relevant to the current selection or insertion point will be displayed on the context menu at a given time.

Users can always access the browser's default context menu by holding down the alt key while brining up the context menu.


The following would add a separator followed by the bold italic and underline buttons after the paste from word button:  


See also:

contextMenu, clearContextMenu, removeContextMenuItem