Implement $map variable, which returns the current composer map item id where the map is being drawn, or 'canvas' if the map is being drawn in the main QGIS window. Partly implements #9288.