I've created a custom fieldtype... which is basically a button that triggers an AJAX action. When I add this field to my section, I can click the button while I'm editing an entry to perform an action.
Here's the thing... How can I tell if the entry needs to be saved? Clearly Craft is aware of whether an entry is unsaved or not, because it'll warn you before navigating away from the page. Is it possible for my button to tap into that same behavior?
This button does not take people away from the page, so I'm not sure if
data-confirm-unload really comes into play here. If the entry is unsaved, the button will be replaced with a message saying, "you must first save the entry".