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
Comment #1
snte commentedComment #2
pablo849 commentedSame here
Comment #3
grahame.thompson commentedI've tested both
- Make this calendar public
- Share only my free/busy information
same error.
Comment #4
cobadger commentedI'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.
Comment #5
dworkin2010 commentedI also experience this issue.
What release version of the google-api-php-client library is everyone using? I'm on 1.1.4.
Alan
Comment #6
trumpetmercenary commentedSame 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).
Comment #7
bduell commentedI 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.
Comment #8
bduell commentedI also added startdate and enddate capabilities to capture that data as well.
Comment #9
cobadger commentedI tested patch #7 and got error on admin/structure/block/add-google-calendar-block:
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.
Comment #10
cobadger commentedModule 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
Comment #11
cobadger commentedChanging status to 'needs review'.
Comment #14
markie commentedI 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.