@@ -33,6 +33,7 @@ define([
3333
3434 // Parameters configured in the Modeler.
3535 buttonTitle : "" ,
36+ buttonGlyphicon : "" ,
3637 isDropUp : "" ,
3738 isRightAligned : "" ,
3839 startOpen : "" ,
@@ -83,7 +84,12 @@ define([
8384
8485 // Really render the interface, if renderAsOpen is true: render the menu in open state
8586 _renderInterface : function ( renderAsOpen , callback ) {
86- this . dropdownButton . innerHTML = this . buttonTitle + "<span class='caret'></span>" ;
87+ this . dropdownButton . innerHTML = this . buttonTitle + "<span class='caret'></span>" ;
88+ // if a glyphicon icon was requested and the splitButton is not wanted: add the glyphicon to the button.
89+ if ( this . buttonGlyphicon !== '' && ! this . splitButtonActive ) {
90+ this . _addGlyphicon ( this . dropdownButton ) ;
91+ }
92+
8793 this . _setButtonTypes ( this . dropdownButton ) ;
8894
8995 // implement visual settings of the widget
@@ -102,7 +108,7 @@ define([
102108 if ( this . splitButtonActive ) {
103109 this . _createSplitButton ( ) ;
104110 } else {
105- domConstruct . destroy ( this . splitButton ) ;
111+ domConstruct . destroy ( this . splitButton ) ;
106112 }
107113
108114 this . _setupEvents ( callback ) ;
@@ -251,11 +257,20 @@ define([
251257 _createSplitButton : function ( ) {
252258 // create the new split button
253259 this . splitButton . innerHTML = this . buttonTitle ;
260+ // if a glyphicon icon was requested: add the glyphicon to the button.
261+ if ( this . buttonGlyphicon !== '' ) {
262+ this . _addGlyphicon ( this . splitButton ) ;
263+ }
254264 this . _setButtonTypes ( this . splitButton ) ;
255265
256266 // adjust the dropdownButtons content
257267 this . dropdownButton . innerHTML = "<span class='caret'></span><span class='sr-only'>Toggle Dropdown</span" ;
258268 } ,
269+
270+ // Add a glyphicon to a button
271+ _addGlyphicon : function ( buttonObject ) {
272+ buttonObject . innerHTML = "<span class='glyphicon " + this . buttonGlyphicon + "'></span>" + buttonObject . innerHTML ;
273+ } ,
259274
260275 // Reset subscriptions.
261276 _resetSubscriptions : function ( ) {
0 commit comments