Skip to content

Widgets: Add Google Maps API key field to Contact Info widget settings#4562

Merged
kraftbj merged 3 commits intomasterfrom
update/contact-info-api-key-field
Jul 28, 2016
Merged

Widgets: Add Google Maps API key field to Contact Info widget settings#4562
kraftbj merged 3 commits intomasterfrom
update/contact-info-api-key-field

Conversation

@aduth
Copy link
Copy Markdown
Member

@aduth aduth commented Jul 27, 2016

Closes #4240

This pull request seeks to add a new "Google Maps API Key" field to the widget settings for Contact Info Widget. See #4240 for more context; specifically that Google now requires a key to be included in all maps products API requests.

API Key

It also changes the existing behavior of map output to always try to display a map, even if an API key is not configured. The hope here is that sites with grandfathered usage can continue to show a map without an API key (see #4242 (comment)).

Testing instructions:

Verify that when configuring a Contact Info Widget, a "Google Maps API Key" field is shown if the "Show Map" option is checked. Save an API key and observe both that the key setting is persisted, and that the key is included in the src of the iframe that is displayed on the front-end of the site.

Follow-up Tasks:

The linked documentation article in the help text does not currently include any instructions on obtaining an API key and should be updated.

/cc @jeherve , @kraftbj

aduth added 2 commits July 27, 2016 10:04
Since the site may have grandfathered permission to display  a map
without an API key
Since multiple widget forms can be present on the same page at the same
time
@jeherve jeherve added this to the 4.2 milestone Jul 28, 2016
@jeherve jeherve added the Enhancement Changes to an existing feature — removing, adding, or changing parts of it label Jul 28, 2016
@jeherve
Copy link
Copy Markdown
Member

jeherve commented Jul 28, 2016

This seems to work in my tests. LGTM imo!

@kraftbj Since you worked on this as well, would you mind giving it another look, and merge if you like what you see?

Thanks!

@jeherve jeherve added [Status] Ready to Merge Go ahead, you can push that green button! and removed [Status] Needs Review This PR is ready for review. labels Jul 28, 2016
@kraftbj
Copy link
Copy Markdown
Contributor

kraftbj commented Jul 28, 2016

It reads well, but latest master and this branch is WSOD on my sandbox without an error. Going to merge and noting we need to update documentation.

@kraftbj kraftbj merged commit 830fe9f into master Jul 28, 2016
@kraftbj kraftbj deleted the update/contact-info-api-key-field branch July 28, 2016 22:12
jeherve added a commit that referenced this pull request Jul 29, 2016
@petrk94
Copy link
Copy Markdown

petrk94 commented Aug 12, 2016

Hello,
I want to use my API key, but I dont see in Version 4.1.1 the API key field in the widget, any idea what I must change to put it in?
Thanks

@aduth
Copy link
Copy Markdown
Member Author

aduth commented Aug 14, 2016

@petrk94 : The form field will be included in Jetpack 4.2, which is expected to be released very soon. 4.1.1 does include the option to specify your own API key, but requires that you use filters to do so.

Specifically, adding the following to your theme's functions.php file should work, replacing the dummy text with your own API key:

function mytheme_google_maps_key() {
    return 'insert-your-api-key-here';
}
add_filter( 'jetpack_google_maps_api_key', 'mytheme_google_maps_key' );

@kraftbj kraftbj removed the [Status] Ready to Merge Go ahead, you can push that green button! label Oct 13, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Enhancement Changes to an existing feature — removing, adding, or changing parts of it [Feature] Extra Sidebar Widgets Touches WP.com Files

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Contact Info Widget - Google Maps require API Keys

5 participants