-
Notifications
You must be signed in to change notification settings - Fork 0
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
Cater for field type google_map
#10
Comments
$field array could contain
$field_info array could contain these fields used to display the Google Maps map.
|
We need to cater for nulls. When the Google Maps address hadn't been set the first version of the code displayed a series of PHP Warnings. We need to consider what to display in the block editor. When the API key is set then the required JavaScript is enqueued. But the Google Maps don't appear in the block, even though they do appear in the Meta boxes. |
According to the documentation at https://www.advancedcustomfields.com/resources/google-map/
the Google Map field provides an interactive map interface for selecting a location.
This field type uses the Google Maps JS API to provide autocomplete searching, reverse geocoding lookup and an interactive marker.
Requirement
Proposed solution
The Google Maps API requires an API key.
ACF finds this using a filter function (
acf/fields/google_map/api
), passing in the values obtained fromacf_get_setting()
, for bothgoogle_api_key
andgoogle_api_client
.The field type should only be supported when an API key is available.
One way of achieving this is to define a Google Maps Field group, which contains the text field for the API key, and is displayed on the ACF Options page(s).
This might require the plugin to call
acf_add_options_page()
, to ensure an Options page is available, and to define the Google Maps field group.Perhaps this can be achieved by the rendering logic when a field of this type is first encountered?!
For helper code see https://www.advancedcustomfields.com/resources/google-map/#google-maps-helper-code
The text was updated successfully, but these errors were encountered: