diff --git a/js/misc/dialog.js b/js/misc/dialog.js
index 5a92e82..1cb02be 100644
--- a/js/misc/dialog.js
+++ b/js/misc/dialog.js
@@ -60,11 +60,28 @@
    * @return {Drupal.dialog~dialogDefinition}
    */
   Drupal.dialog = function (element, options) {
+    var elementIsString = typeof element == 'string';
     var $element = $(element);
+    if (elementIsString) {
+      var $modal = $('<div class="modal fade" role="dialog">');
+      var $dialog = $('<div class="modal-dialog" role="document">');
+      $modal.append($dialog);
+      var $content = $('<div class="modal-content">').appendTo($dialog);
+      if (options.title) {
+          $('<div class="modal-header"><button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button></div>')
+            .append($('<h4 class="modal-title">').html(options.title))
+            .appendTo($content);
+      }
+      $content.append($('<div class="modal-body">').append($element))
+        .append('<div class="modal-footer">');
+      $element = $modal;
+      $('body').append($element);
+    }
 
     function openDialog(settings) {
       settings = $.extend({}, drupalSettings.dialog, options, settings);
       // Trigger a global event to allow scripts to bind events to the dialog.
+      createButtons($element);
       $(window).trigger('dialog:beforecreate', [dialog, $element, settings]);
       $element
         .modal(settings)
@@ -84,6 +101,64 @@
           $(window).trigger('dialog:afterclose', [dialog, $element]);
         })
         .modal('hide');
+
+      if (elementIsString) {
+        window.setTimeout(function() {
+          $element.remove();
+        }, 2000);
+      }
+    }
+
+    function createButtons($element) {
+      debugger
+      var buttons = options.buttons;
+
+      // If we already have a button pane, remove it
+      // this.uiDialogButtonPane.remove();
+      // this.uiButtonSet.empty();
+
+      var $footer = $element.find('.modal-footer');
+      if (!$footer.length) {
+        $footer = $('<div class="modal-footer">').appendTo($element.find('.modal-dialog'));
+      }
+
+      if ( $.isEmptyObject( buttons ) || ( $.isArray( buttons ) && !buttons.length ) ) {
+        this._removeClass( this.uiDialog, "ui-dialog-buttons" );
+        return;
+      }
+
+      $.each( buttons, function( name, props ) {
+        var click, buttonOptions;
+        props = $.isFunction( props ) ?
+          { click: props, text: name } :
+          props;
+
+        // Default to a non-submitting button
+        props = $.extend( { type: "button" }, props );
+
+        // Change the context for the click callback to be the main element
+        click = props.click;
+        buttonOptions = {
+          icon: props.icon,
+          iconPosition: props.iconPosition,
+          showLabel: props.showLabel,
+
+          // Deprecated options
+          icons: props.icons,
+          text: props.text
+        };
+
+        delete props.click;
+        delete props.icon;
+        delete props.iconPosition;
+        delete props.showLabel;
+
+        $( "<button></button>", props )
+          .appendTo( $footer )
+          .on( "click", function() {
+            click.apply( $element[ 0 ], arguments );
+          } );
+      } );
     }
 
     var dialog = {
@@ -97,7 +172,6 @@
       },
       close: closeDialog
     };
-
     return dialog;
   };
 
