return p;
};
+ /**
+ * Set the title text of a button.
+ *
+ * This method is overloaded to take either a string value for the button title or a jQuery promise that is resolved with
+ * text most commonly from a Str.get_string call.
+ *
+ * @param {DOMString} action The action of the button
+ * @param {(String|object)} value The button text, or a promise which will resolve to it
+ * @returns {Promise}
+ */
+ Modal.prototype.setButtonText = function(action, value) {
+ const button = this.getFooter().find(this.getActionSelector(action));
+
+ if (!button) {
+ throw new Error("Unable to find the '" + action + "' button");
+ }
+
+ return this.asyncSet(value, button.text.bind(button));
+ };
/**
* Get the Selector for an action.
modal.setFooter(modalConfig.footer);
}
+ if (modalConfig.buttons) {
+ Object.entries(modalConfig.buttons).forEach(function([key, value]) {
+ modal.setButtonText(key, value);
+ });
+ }
+
if (isLarge) {
modal.setLarge();
}