WordPress.org

Make WordPress Core

Opened 2 years ago

Last modified 11 months ago

#23622 new feature request

Support Google Maps / Docs / Spreadsheet embeds

Reported by: Otto42 Owned by:
Milestone: Future Release Priority: normal
Severity: normal Version:
Component: Embeds Keywords: needs-refresh
Focuses: Cc:

Description

Google Maps and Drive (docs, spreadhseets, and presentations) all can do embeds, but don't support oEmbed. Still, I think they're big enough for the core to have support for natively. We already have Google Video support, and it's pretty much dead now.

Initial patch attached.

  • To get a Maps URL, view a Google Map, then select the "Link" icon in the left menu bar, top-right corner.
  • To get a docs/sheet/presentation URL, open the item, select "File->Publish To Web. Once it's published and visible to the web, the dialog will give a link for you to copy/paste.

This uses the normal embed handler, meaning that either the [embed] shortcode or just pasting the URL on a line by itself will trigger the embed. Width and height parameters are supported, and Presentations has special parameters to allow full-screen viewing.

Attachments (1)

23622.diff (3.2 KB) - added by Otto42 2 years ago.
Add Google Maps and Drive support for embeds

Download all attachments as: .zip

Change History (17)

@Otto422 years ago

Add Google Maps and Drive support for embeds

comment:1 @wpsmith2 years ago

  • Cc t@… added

comment:2 @bananastalktome2 years ago

  • Cc bananastalktome@… added

comment:3 @toscho2 years ago

  • Cc info@… added

comment:4 @MadtownLems2 years ago

  • Cc jason.lemahieu@… added

I'm ecstatic to see this considered for Core. I've taken a look at your code, and took it for a test drive. I had no issues embedding maps, docs, spreadsheets, or presentations.

I was even able to embed a google form after I extracted the proper URL from the iframe source code it tried giving me (something in the form of https://docs.google.com/spreadhsett/embeddedform?formkey=abc123)

Version 0, edited 2 years ago by MadtownLems (next)

comment:5 @Otto422 years ago

I think the regexp's need a bit more tweaking before going into core. If somebody could do the legwork and find as many real-world examples of possible URLs for these sorts of items and make a list, that would certainly help.

comment:6 @MadtownLems2 years ago

For what it's worth, I did testing against both a traditional Google account, as well as an account that's part of a Google Apps for EDU setup.

While the Google Apps for EDU account will often give you publicly viewable URLs that contain the domain name, such as http://docs.google.com/a/my-university.edu/spreadsheet/ccc?key=abc123, it looks like those portions of the URLs are removed after using the Publish to Web option.

TL;DR - works with Google Apps for EDU :)

comment:7 @MadtownLems2 years ago

I've done some more playing, and have had success with expanding the amount of things that can be easily embedded, including files (such as videos, PDFs, Word docs, etc), forms, and entire Drive folders.

My current iteration uses this in the RegEx: (document|spreadsheet|presentation|forms|file|folder)

Any thoughts/concerns about allowing embeds of these additional types as well?

comment:8 @mordauk2 years ago

  • Cc pippin@… added

I haven't tested this yet, but I love the idea of it being in core.

comment:9 @mordauk2 years ago

Initial tests of maps works great.

comment:10 @sunnyratilal2 years ago

  • Cc sunnyratilal5@… added

comment:11 @MadtownLems2 years ago

Is there a particular reason you're not looking at including Google Calendars as part of this?
(If so, I'm guessing it's due to the ginormous number of options available when displaying calendars?)

comment:12 @Otto422 years ago

Yes. Basically, I can't find any way to embed a Google Calendar. No options for any form of embedding in the interface that I can find.

comment:13 @MadtownLems2 years ago

Have you looked at the Google Embeddable Calendar Helper?

https://www.google.com/calendar/embedhelper

comment:14 @MadtownLems15 months ago

FYI - Google is rolling out 'New' Google Maps, which currently have a different URL structure, not covered by this patch. Additionally, it even appears that users logged into google are getting URLS with www.google.com/maps/, despite having the 'Classic' interface. The only way I'm getting maps.google.com URLs, supported by this patch, are when I'm not logged into Google at all.

comment:15 @emiliengerbois14 months ago

Hi everybody,
it's such a great function you built! congrats and thanks!
are there any news about MadtownLems questions on new Google Urls ?
thxs again

comment:16 @wonderboymusic11 months ago

  • Keywords needs-refresh added
  • Milestone changed from Awaiting Review to Future Release
Note: See TracTickets for help on using tickets.