Add possibility to define icons for plugin-buttons

Change-Id: I4a30fa72953ae6136d5c5056c992bdadac135ffe
diff --git a/dev/js/src/buttongroup.js b/dev/js/src/buttongroup.js
index 01e5a1c..f7acfb7 100644
--- a/dev/js/src/buttongroup.js
+++ b/dev/js/src/buttongroup.js
@@ -31,9 +31,9 @@
 
     
     /**
-     * Upgrade this object to another object,
+     * Upgrade this object to another object, 
      * while private data stays intact.
-     *
+     * 
      * @param {Object} An object with properties.
      */
     upgradeTo : function (props) {
@@ -46,15 +46,21 @@
     
     /**
      * Add button in order
-     *
+     * 
      * Returns the button element
      */
-    add : function (title, classes, cb) {
+    // TODO: Accept an object instead of a list
+    add : function (title, classes, cb, icon) {
       var b = this._element.addE('span');
       b.setAttribute('title',title);
       if (classes !== undefined) {
         b.classList.add.apply(b.classList, classes);
       };
+     
+      if (icon !== undefined){ 
+        b.setAttribute('data-icon', icon);
+      };
+     
       b.addE('span').addT(title);
 
       var that = this;
@@ -75,7 +81,7 @@
     
     /**
      * Add button that spawns a list in order.
-     *
+     * 
      * Returns the list object.
      */
     addList : function (title, classes, itemClass = defaultItemClass) {
@@ -136,8 +142,8 @@
     },
 
     /**
-     * Bind an object to all callbacks of the button group.
-     * To get the button element inside the callback,
+     * Bind an object to all callbacks of the button group. 
+     * To get the button element inside the callback, 
      * use this.button
      */
     bind : function (obj) {
diff --git a/dev/js/src/plugin/server.js b/dev/js/src/plugin/server.js
index 7a2d305..90dcd7c 100644
--- a/dev/js/src/plugin/server.js
+++ b/dev/js/src/plugin/server.js
@@ -133,8 +133,8 @@
         let title = embed["title"];        
         let panel = embed["panel"];
         let onClick = embed["onClick"];
-
-
+        let icon = embed["icon"];
+        
         if (!panel || !(buttons[panel] || buttonsSingle[panel]))
           throw new Error("Panel for plugin is invalid");        
 
@@ -160,20 +160,20 @@
 
           // Add to dynamic button list (e.g. for matches)
           if (buttons[panel]) {
-            buttons[panel].push([title, embed["classes"], cb]);
+            buttons[panel].push([title, embed["classes"], cb, icon]);
           }
 
           // Add to static button list (e.g. for query) already loaded
           else if (KorAP.Panel[panel]) {
-            KorAP.Panel[panel].actions.add(title, embed["classes"], cb);
+            KorAP.Panel[panel].actions.add(title, embed["classes"], cb, icon);
           }
 
           // Add to static button list (e.g. for query) not yet loaded
           else {
-            buttonsSingle[panel].push([title, embed["classes"], cb]);
+            buttonsSingle[panel].push([title, embed["classes"], cb, icon]);
           }
         }
-
+        //TODO There is no possibility to add icons to an plugin toggle button right now. 
         else if (onClick["action"] == "toggle") {
 
           // Todo: Initially false