backdrop-contrib / ip_geoloc

IP Geolocation Views & Maps for Backdrop CMS.
GNU General Public License v2.0
0 stars 2 forks source link

Views location differentiator and associated markers not saved #8

Open pgrayove-mcpl opened 1 year ago

pgrayove-mcpl commented 1 year ago

In the views format Map (Google API, via IPGV&M) settings, the location differentiator marker settings will not save. You can see and select markers that are in the marker directory, but the settings do not save and only the default marker displays on the map.

This notice displays when selecting a location differentiator: Notice: Array to string conversion in backdrop_attributes() (line 2835 of /app/core/includes/common.inc).

AlexHoebart-ICPDR commented 8 months ago

I'm using Leaflet, not Google Maps, but I think the problem and fix could be the same. See PR at https://github.com/backdrop-contrib/ip_geoloc/pull/9

AlexHoebart-ICPDR commented 3 months ago

I noticed that the previous fix only addresses simple cases, there are two more cases when location differentiator and associated markers are not saved:

  1. When the differentiator field drop-down is changed: in this case the $form_state['differentiator'] still has the old value and saving values for the newly selected differentiator fails - must be something related to different way of form handling in Backdrop.
  2. There seem to be differences in Backdrop how to identify Taxonomy reference fields and how default values for fields have to be provided, so these fields did not work in the settings form and therefore were also not saved correctly. I updated this, not sure if it covers all cases but it worked for me now with core taxonomy and list fields.

I will provide a PR.

laryn commented 1 month ago

@pgrayove-mcpl Any chance you're interested in testing this one? https://github.com/backdrop-contrib/ip_geoloc/pull/15

pgrayove-mcpl commented 1 month ago

I can test it out. Might not get to it until tomorrow.

pgrayove-mcpl commented 1 month ago

@laryn I am still seeing an issue. I have a taxonomy for bookmobile/van stops which can be either Library Building, Van Stop, or Bookmobile Stop. I tried to set these as the marker differentiators and the view saved the style/colors I chose, but did not save the bookmobile/van stop value as you can see in this screenshot. Let me know if there's any additional info I can provide. image

AlexHoebart-ICPDR commented 1 month ago

@pgrayove-mcpl Is this a View on a content type with a single-value Term Reference field or any other configuration? I also noticed that one has to add the map attachment, save the View, and only then you can add and save the marker associations. For some reason, the marker associations are saved in the configuration of the module, not of the View. Can you check, what is saved in your ip_geoloc.settings.json file under ipgeoloc{your_view_name}_color_mappings?

pgrayove-mcpl commented 3 weeks ago

@AlexHoebart-ICPDR The map is built from a content type with an entity reference for the marker. I do have the map saved as a display in the view. I already had a map set up in the views and then just switched it to using ip_geoloc for the marker associations. The marker associations are being saved in the configuration module, but they aren't displaying on the map itself. Here's what I've got in the ip_geoloc.settings.json file: "ip_geoloc_clone_of_bookmobile_stops_new_color_mappings": { "page_4": { "field_bookmobile_van_stop": [ { "differentiator_value": [ "27582" ], "color": "green", "special char": "", "special char class": "" }, { "differentiator_value": [ "27584" ], "color": "LFL-icon", "special char": "", "special char class": "" }, { "differentiator_value": [ "27583" ], "color": "gray", "special char": "", "special char class": "" } ] } } } When I view the map though, all I see are green makers for everything. There aren't actually any van stops included in this map, but there should be 3 library buildings showing up as gray markers and they are all using the default green markers.