Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Change Google Picker DocsView Title

I am using Google Picker API on my website. This is my code:

this.picker = new google.picker.PickerBuilder().
            addView(new google.picker.DocsView(google.picker.ViewId.DOCS).
                    setIncludeFolders(true).
                    setOwnedByMe(true)).
            addView(new google.picker.DocsView(google.picker.ViewId.DOCS).
                    setIncludeFolders(true).
                    setOwnedByMe(false)).
            addView(google.picker.ViewId.RECENTLY_PICKED).
            addView(new google.picker.DocsView(google.picker.ViewId.DOCS).
                    setStarred(true)).
            setAppId(this.clientId).
            enableFeature(google.picker.Feature.MULTISELECT_ENABLED).
            disableFeature(google.picker.Feature.SUPPORT_TEAM_DRIVES).
            setOAuthToken(accessToken).
            setLocale('es').
            setTitle('Selecciona uno o varios archivos').
            setCallback(this._pickerCallback.bind(this)).
            build().
            setVisible(true);

Which is being shown as (names are censored but they are showing as they should):

enter image description here

The issue is the starred DocsView, which has the title "Google Drive". I would like to change it to something of my choice (the rest of the DocsView have default names) or just "Starred" but I just cannot achieve this.

Does someone know how can I change that?

like image 576
Aldeguer Avatar asked Jan 26 '18 10:01

Aldeguer


2 Answers

It is not documented, at least not here, but DocsView.setLabel method worked for me. So, try the following:

    new google.picker.DocsView(google.picker.ViewId.DOCS).
      setStarred(true).
      setLabel("Starred")
like image 165
Oleksiy Rudenko Avatar answered Oct 07 '22 00:10

Oleksiy Rudenko


It looks like you're not alone in this! You can see in 2014 someone else had a similar issue: https://groups.google.com/forum/#!topic/google-picker-api/9x5a_VAb73k

I had tested this out extensively myself with different options, and it appears that the field is entirely controlled by Google, because it is in an iFrame.

It seems like a bug on Google's part, particularly since it doesn't do any of the localization (although that might be intended since the product is named "Google Drive").

Until Google changes that, it cannot display anything other than "Google Drive".

Additionally, I attempted to report it, which you can see here: https://issuetracker.google.com/73046870

like image 3
mootrichard Avatar answered Oct 07 '22 00:10

mootrichard