Not that I know. Should I?
This code works, however, as it properly adds the element in the hamburger menu:
api.decorateWidget("hamburger-menu:generalLinks", function(helper) {
return {href: "", rawLabel: "test"}
});
But I don’t know if I can call showModal("fareharbor"); without using a widget.
And Happy Birthday. ![]()
edit:
Heres’ my full code:
const showModal = require("discourse/lib/show-modal").default;
api.createWidget("modal-button", {
tagName: "a.test",
html() {
return "Open Modal";
},
click() {
showModal("fareharbor");
}
});
// doesn't work
api.decorateWidget("hamburger-menu:generalLinks", function(helper) {
return [helper.widget.attach('modal-button')];
});
// works
api.decorateWidget("hamburger-menu:generalLinks", function(helper) {
return {href: "", rawLabel: "test"}
});
The return [helper.widget.attach('modal-button')]; part creates an empty link:
<li><a class="widget-link" href="" title=""><span class="d-label"></span></a></li>
