Happy holidays everyone.
Hope someone can help me in thinking about a problem I've run into.
I have a plugin Im building that allows the user to pull address data from the maps API - ie it validates an address and if it is a business, pulls the marker icon, address details, web link etc. and builds a shortcode to render the map on the front end. At the moment the shortcode is being built and result previewed via a tinyMCE modal window.
Creating the map marker content (marker info bubble) is what is causing me greif. I wanted the user to be able to add or manipulate the content of this block, but the net result is a fair amount of markup.
So far I've tried to pass the generated markup though one of the shortcode attributes like so:
[my_gmaps id="map" z="11" w="100%" h="300" scrollwheel="false" maptype="ROADMAP" address="Southampton, United Kingdom" marker="true" markerimage="http://anachronistic.local:9102/wp-content/plugins/_TomRush/inc/js/TinyMCE_additions/modal/../img/icons/music_folk_map.png" infowindow="<div class="marker inside"><img class="marker icon" alt="" src="http://maps.gstatic.com/mapfiles/place_api/icons/geocode-71.png" /><strong>Southampton</strong><br>Southampton, UK<br><span class="marker extras">Some User Note</span></div><a class="marker jumplink" href="https://maps.google.com/maps/place?q=Southampton&ftid=0x48738957be152909:0xa78c5a6a4cda71f0" target="_blank">external map</a>" ]
What I've found (probably no surprise to you all) is that the visual editor wreaks havoc on the shortcode, especially the infowindow atribute, adding line breaks and stripping the <br>
tags for starters. I want the user to be able manipulate the marker content but this isn't a tenable solution.
How can I pass this information without the editor mangling it? Is this where I need to learn the transients API or should I consider another approach?
Many thanks in advance for your experience.