Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New Field Type: Address / Map #3634

Open
wants to merge 102 commits into
base: main
Choose a base branch
from
Open

Conversation

sc0ttkclark
Copy link
Member

@sc0ttkclark sc0ttkclark commented Jul 6, 2016

Patched from https://github.com/pods-framework/pods-address-maps
#657

Bringing over PR from #3623

Address field type

  • Name field type "address" (type) / "Address" (label)
  • Display in frontend with HTML markup
  • Custom HTML markup possible with magic tags ( {{address_tag}} )
  • Option to format in schema.org microdata
  • Extend the province/region options. @JoryHogeveen (related: Feature request - Ability to have field for country/region/city selection #4116)
    • Add an option to set this as a select box instead of a text input. (currently only supports US states)
    • Add a callback function that looks for a list file with existing provinces/region options by country (parameter) + add a filter to change/extend this list.
    • Add a small AJAX script that autofills the available options based on the above callback.

Maps component

Backend UI

  • Base (currently loads the map with the correct address
  • Hidden lat/lng fields when address or free-form display is selected
  • Store lat/lng values after call to geocoder (even if these fields are not visible) to decrease number of api calls
  • Determine where API call should and shouldn't be done

Frontend UI

  • Display address field as a map on front end with use of the providers
  • I'd say it's important that this plugin returns an array instead of the display value when using get_post_meta, possible workaround for this?
  • Fix: Array storage triggers display() multiple times
  • Option to set width/height @JoryHogeveen
  • Option to use a Pods Template for the infowindows / marker-tooltip. @JoryHogeveen

API

  • API methods for sorting objects based on GEO - wp ticket
  • Map display options for object relationships or a list of objects @JoryHogeveen
    • Make base front-template work with multiple values (basics) @JoryHogeveen
    • Option to order by distance (straight line can be done without API) - example

Providers

Google Maps API handler (priority)

Display

  • Load the map in backend
  • Show markers
  • Update fields when moving the marker
  • Update GEO data when changing the field values (freeform & address input type)
  • Show infowindows
  • Display address values or custom input data in infowindow
  • Custom markers (field type file not working in the field edit tab @sc0ttkclark )
  • Map style (interactive map / static image)
  • Map type (terrain, satellite, etc)
  • Front-end display (based on back-end field display, but then with limited functions etc)
  • Option to disable scrolling @JoryHogeveen

General

  • Determine storage structure @sc0ttkclark
  • Determine validation @sc0ttkclark
  • Fix todo's @sc0ttkclark
    • fields/address.php
      • L202 - Storage types
      • L286 - Validate each returned value for variable type and content (sanitizing)
      • L414 - check pregreplace, maybe this can be done better (nl2br not working)
    • Maps.php (component)
      • L87 (assets) - Allways load required front end assets: Maybe as an option?
      • L217 - Put part of the general maps config in the maps provider class? This could be different between providers.
      • L311 - Put maps field options in the maps provider class? This could be different between providers.
      • L329 - Autocorrect is not implemented yet (maybe old?)
      • L409 - 'display_type' is only available for field type 'address'
      • L535 (validation) - Validate based on address type ( lat / lon, address fields)
    • front/map-google.php + field/map-google.php - Check field type: support other field types for maps?
  • Delete old/unused files
  • Tests!

Future tasks

Structure

  • MV-field structure (+ maps logic in a JS object) @pglewis
  • Global maps JS file instead of inline within the field/front files

Other API integrations

  • Bing Maps API handler (needs research + contributor!)
  • OpenStreetMap API handler (needs research + contributor!)
  • Leaflet API handler (needs research + contributor!) http://leafletjs.com/index.html

@sc0ttkclark sc0ttkclark added Status: In Progress Issue or PR is currently in progress but not yet done Patch labels Jul 6, 2016
@sc0ttkclark sc0ttkclark added this to the Pods 2.7 milestone Jul 6, 2016
@sc0ttkclark sc0ttkclark self-assigned this Jul 6, 2016
@sc0ttkclark sc0ttkclark changed the title First commit for address/map field patched from https://github.com/po… 2.7 New Field Type: Address / Map Jul 6, 2016
@JoryHogeveen
Copy link
Member

This field is not ready for full review yet, maybe remove that label.

I'll put the same question here for clarity:

@sc0ttkclark @pglewis
Why not set the regular address fields as default (no map options etc) and add the map options with a component.
This way the address field is a regular field with multiple inputs and a component can extend this field with extra options for Google Maps or even order map providers.

The default address field would be quite similar to the GF address field this way (just regular fields and select boxes)
Let me know your thoughts on this.

@JoryHogeveen JoryHogeveen self-assigned this Jul 6, 2016
@sc0ttkclark
Copy link
Member Author

Still needs review of PR and that question

@JoryHogeveen JoryHogeveen added the Status: Need Dev Feedback Waiting on feedback from developer of PR label Jul 6, 2016
- Add address in backend
- Display address in frontend with HTML markup (config with format)
- Custom HTML markup format possible with magic tags
- Optionally add schema.org microdata
@JoryHogeveen JoryHogeveen removed the Status: Need Dev Feedback Waiting on feedback from developer of PR label Aug 6, 2016
Currently only handles PodsAdmin fields
Requires PR: #3711
Also adds classes for use in front-end prepended with `pods-address`
- All maps additions are now in the component folder for consistency
- Main component handles default (global) calls and redirects them to
the right provider class
- Field UI: Use the localization JS object and extend this for more
usages like ajax calls to the main component for geodata
- Field UI: Geodata lookup when typing a new address
- Provider: API key is recently required for Google Maps
- Bring back "lookup" button, seems like a better approach
- Validate the view type that this map field is appended to
@jimtrue
Copy link
Contributor

jimtrue commented Jan 28, 2019

@bwdgraphics I responded over on the WordPress.org forums; what are you using to perform the import with?

@bwdgraphics
Copy link

Yes, that's how I arrived here, actually. We can close that other thread. WP All Import is working fantastically, but when I try to map all those individual fields to the one "address" field for the pods-maps plugin/add-on, no data is received. Is there a simple solution that I'm missing?

@jimtrue
Copy link
Contributor

jimtrue commented Jan 28, 2019

Sounds like it might be a 'structure' question (ie how to combine those fields into an array to be supported by the Map Field. @JoryHogeveen might be able to give some insight on this one. I'll close the other ticket: https://wordpress.org/support/topic/importing-to-address-field/#post-11139966

@JoryHogeveen
Copy link
Member

@bwdgraphics
Please see: http://www.wpallimport.com/documentation/custom-fields/serialized-fields/

Also, I think it's better to create a new ticket for topics like this. Let's keep this thread purely for development purposes.

@JoryHogeveen
Copy link
Member

@tiptronic Since I couldn't wait for this to be actually finished and integrated into Pods I created a plugin to work with (actually 2 plugins, the address field and the maps component).
Keep in mind that if you are not comfortable with PHP (coding in general) I'm not sure it will be suitable.
Repo: https://github.com/JoryHogeveen/pods-address-maps

@JoryHogeveen JoryHogeveen added Type: Feature Features that add entirely new functionality that was not there before Status: Need Research Status: Need Dev Feedback Waiting on feedback from developer of PR Component: DFV Issues related to the Pods DFV JS that powers form fields labels Jan 30, 2019
@tiptronic
Copy link

@JoryHogeveen I am not really a PHP Pro, but I will definitely have a look at it asap, as I can definitively use this here and there. Thanks for sharing!

@sc0ttkclark sc0ttkclark removed the request for review from pglewis September 2, 2019 15:37
@sc0ttkclark sc0ttkclark modified the milestones: Pods 2.8, Pods 2.9 Apr 18, 2021
@sc0ttkclark sc0ttkclark dismissed a stale review via 8ea91bf August 4, 2021 15:43
Base automatically changed from release/2.8 to main October 18, 2021 17:07
@oligoform
Copy link

we run into issues with this in pods 2.8. This helps a little
JoryHogeveen/pods-address-maps@1af43f9 but the geolocation doesn't work anymore.
maybe we could use /tribe-common/src/Tribe/Utils/Coordinates_Provider.php for this in pods 2.8? But how? I cannot choose it from the "shipped" pods fields.

@sc0ttkclark sc0ttkclark modified the milestones: Pods 2.9, Pods 3.0 Jul 27, 2022
@sc0ttkclark sc0ttkclark modified the milestones: Pods 3.0, Backlog Apr 25, 2023
@JoryHogeveen JoryHogeveen modified the milestones: Backlog, Pods 3.1 Sep 4, 2023
@sc0ttkclark sc0ttkclark modified the milestones: Pods 3.1, Pods 3.3 Dec 11, 2023
@JoryHogeveen JoryHogeveen modified the milestones: Pods 3.3, Pods 3.2 Feb 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: DFV Issues related to the Pods DFV JS that powers form fields Status: In Progress Issue or PR is currently in progress but not yet done Status: Need Dev Feedback Waiting on feedback from developer of PR Status: Need Research Type: Feature Features that add entirely new functionality that was not there before
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants