It looks like leaflet_helper.parsers.js is hard-coded for the ImageEvents service with hard-coded attributes and static icons. This should be updated to dynamically support this type of layer as the ImageEvents layer may change over time, and any additional ESRI layers should be supported.
Icons should be loaded dynamically via the ESRI API and which attributes to use for a popup text/image should be some sort of extended parameter when adding the layer to make this capability more flexible.
Similar results could be accomplished in two different ways:
Use the ESRI map service to add image tiles to the map, then use the ESRI identify or query service to identify and build the popup on each map click.
Use the ESRI query service to query for each feature in the display, parse the results for the icons and other attributes then generate a selectable layer without having to run identify on each map click
ESRI appears to use option 1 in their standard web map template
It looks like leaflet_helper.parsers.js is hard-coded for the ImageEvents service with hard-coded attributes and static icons. This should be updated to dynamically support this type of layer as the ImageEvents layer may change over time, and any additional ESRI layers should be supported.
Icons should be loaded dynamically via the ESRI API and which attributes to use for a popup text/image should be some sort of extended parameter when adding the layer to make this capability more flexible.
Similar results could be accomplished in two different ways:
ESRI appears to use option 1 in their standard web map template