I'm dipping my toes into the Custom widget waters, so apologies for the amateur question. Basically we have deployed an app configured in Web Appbuilder (via AGOL) onto one of our application servers (development environment). I want to add a simple widget that toggles from basemap to aerials. I've found the relevant code in the Javascript API (ArcGIS API for JavaScript Sandbox).
My plan is to use this code and work it into a version of the CustomWidgetTemplate files from Web AppBuilder Developers edition (from the stmapp/widgets directory) and then add a reference to it in the config.js file for the app (putting the new widget code in the correct spot in the app's widgets folder).