After installing the module and configuring a block, i get the following error on every page the block is placed:

Fatal error: Call to a member function getItems() on a non-object in /(PATH-TO-DRUPAL)/sites/all/modules/google_calendar_block/google_calendar_block.module on line 528

Just a quick test, creating a hardcoded test array in line 529, makes it work with the test values.

 $variables = array(
        'created' => 'test',
        'description' => 'test',
        ...

Could this happen when something is wrong with my configuration, so that a non-object is returned?

Ensure that your calendar has been made public by visiting the Share this Calendar tab and selecting both the Share this calendar with others and Make this calendar public options.

I could not follow the instruction 'share this calender', in the Google calender settings the only thing i find is:
- Make this calendar public (which i checked)
- Share only my free/busy information (?)

... but no 'share this calender' checkbox or anything.

Any help is appreciated!
Thanks

Comments

snte’s picture

Component: Code » User interface
pablo849’s picture

Same here

grahame.thompson’s picture

I've tested both
- Make this calendar public
- Share only my free/busy information

same error.

cobadger’s picture

I'm experiencing the same issue, and I don't believe that it's related to calendar privacy settings.

Seems as though google_calendar_block.module is creating an array ($data) on 498 and then sets $calendars[$cid] to the value of that array in 512. Then on 528 in the foreach statement, it tries to call the getItems() function on $calendars[$cid], which is an array.

dworkin2010’s picture

I also experience this issue.

What release version of the google-api-php-client library is everyone using? I'm on 1.1.4.

Alan

trumpetmercenary’s picture

Same for me, calendar is blank, but I was missing google-api-php-client.

I installed google-api-php-client in sites/all/libraries (latest version) and then got the white screen of death on my site after doing this.

Apache error log says: PHP Fatal error: Call to a member function getItems() on a non-object in /local/sites/sites/all/modules/google_calendar_block/google_calendar_block.module on line 528.

I'm checking with someone to see if the calendar is public, but if it is, I'm not sure what else it could be?

Also, after getting rid of google-api-php-client to bring the site back up, an error is briefly displayed on all pages (refreshing makes it go away):

User deprecated function: google-api-php-client's autoloader was moved to src/Google/autoload.php in 1.1.3. This redirect will be removed in 1.2. Please adjust your code to use the new location. in require_once() (line 25 of /local/sites/sites/all/libraries/google-api-php-client/autoload.php).

bduell’s picture

I was having this same issue, but in this patch I fix the duplicate build of the items, added a setting for caching (in my case I wanted to change the parameters on the fly), and I also added a drupal_alter call so I wasn't locked in to an items_list rendering of the results.

bduell’s picture

I also added startdate and enddate capabilities to capture that data as well.

cobadger’s picture

I tested patch #7 and got error on admin/structure/block/add-google-calendar-block:

Notice: Undefined index: calendar_block in google_calendar_block_custom_block_form() (line 309 of /[path]/sites/all/modules/google_calendar_block/google_calendar_block.module).

Initialized $edit['calendar_block'] in function google_calendar_block_custom_block_form and this error went away.

But the good news is that patch #7 eliminated the original problem: "Fatal error: Call to a member function getItems() on a non-object"

Attached is an update to the patch with the initialization of $edit['calendar_block'] included.

cobadger’s picture

Module wasn't rendering the block for me.

Changed function name from:

function google_calendar_calendar_block_content_alter

to:

function google_calendar_block_calendar_block_content_alter

cobadger’s picture

Status: Active » Needs review

Changing status to 'needs review'.

The last submitted patch, 7: google_calendar_block-fixforgetItems-2538582-7-7.39.patch, failed testing.

The last submitted patch, 9: google_calendar_block-fixforgetItems-2538582-8-7.39.patch, failed testing.

markie’s picture

I dug into this issue, and found that the api that pulls the calendar items shoves the data all into a single array key. So instead of having an array of items, you get one. I used the following to get the proper content output.