The user Canapin asks how to display a widget in the hamburger menu, specifically a button that opens a modal. They attempt to use api.decorateWidget with helper.widget.attach, but the widget appears as an empty link. Jordan.vidrine suggests the correct method is helper.widget.attach(), but this doesn’t resolve the issue. Canapin confirms that adding a simple HTML element or a regular link works, but the widget doesn’t render properly. Jordan.vidrine acknowledges the issue and says it will be investigated. Eviltrout explains that generalLinks expects link widget arguments, not widget instances, and suggests using an action to open the modal instead, providing a working example.
Yes, it shows some normal stuff I guess (when I trigger the modal): (e,t){t=t||{};var n=(0,c.getOwner)(this),s=n.lookup("route:application"),a=s.controllerFor("modal");a.set("modalClass",t.modalClass||"".concat((0,u.dasherize)(e).toLowerCase(),"-modal"));var i=t.admi…
But unless I’m misunderstanding something, my issue isn’t the modal interaction (which works), but placing my widget in the hamburger menu.
I followed this modal creation tutorial and it works perfectly, the custom button shows the modal.
The modal works.
Adding the widget button in a template works and triggers the modal.
Adding a regular link in the hamburger menu works.
…But adding the widget button in the hamburger doesn’t work and creates an empty link instead. Are there some restrictions of some kind when using decorateWidget with “hamburger-menu”?
So the example above is returning another Widget instance, when in fact you need to return one or more javascript object literals like in your working example. Those objects are the arguments to the link widget to make the links appear correctly.
It looks like the reason you want to do this is to open a modal. That’s achievable using an action. Try this: