I've looked in every panel in both manage fields and manage display, and I can't find the option for Add to Cal -- in the Format column, Field column, Widget column, etc. I've read the blog entry about it -- http://thinkshout.com/blog/2012/06/kyle/add-to-cal -- and can't find anything else to do.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Anonymous’s picture

Try this, it seemed to work for me:

  • Change the display widget to "Add to calendar"
  • Flush the cache (I prefer drush cc all)
  • Go back to the content type and re-save the "add to calendar" widget
  • ?????
  • Reload an event page (or whatever content type you are using) to see the awesomeness.

If the cache clearing is necessary and we can track down the point where it is needed maybe we can use cache_clear_all($cid = NULL, $bin = NULL, $wildcard = FALSE) to do this automagically?

somatics’s picture

There is no widget option from the Manage Fields list for Add to Calendar -- just the options for Text field and Pop-up calendar. On the Manage Display list, there is no column for Widgets, just the column for Format, and it also doesn't give me the option of Add to Cal. I can't find that option anywhere. I don't know what to do.

Anonymous’s picture

You should be able to find it under Structure > Content Types > Event (or whatever you called it) then by going to Manage Display, finding your Date field (or whatever you called it) and in the Format column, selecting "Add to Calendar".

If it is not there, double check that the module is installed. You may also want to clear your caches as suggested above. That can be done from the Configuration > Performance page if you're not using drush. Beyond that I'm not sure what else to suggest as I'm not the author of this module.

somatics’s picture

The format column for my Date field in Manage Display only gives me the options of:

* Date and time
* Time ago
* Plain

The module is enabled. I clear cache (via the gui, Drush, and/or my host's control panel) regularly when I'm installing modules and otherwise developing. It doesn't appear to change anything on this front.

BrightBold’s picture

Title: Add to Cal option not present anywhere -- don't know what to do to make it show up » Add to Cal option not present for Date formats other than datetime
FileSize
117.46 KB

I have figured this out after spending several hours on it and feeling like a complete idiot that I couldn't install a simple module. The module only works if your date field is a "datetime" field. Mine are "Date (ISO format)" as recommended by Karen S (see http://groups.drupal.org/node/221254).

If you change line 58 in addtocal.module from 'field types' => array('datetime'), to 'field types' => array('date'), then the Add to Cal format option appears, and works as intended. (Also, I found I had to check the "show Add to Cal widget for Past Events" option to get the button to show up on the Event node, so be sure to check that box—I'll file a separate issue for that.)

So I guess this module just needs to be a tiny bit more abstracted. ;) The fix may be as simple as changing line 58 to accept all three allowed date formats, but I don't know whether there are other potential consequences of that change. It seems to be working fine for me, however.

antipex’s picture

Version: 7.x-1.0-beta1 » 7.x-1.x-dev
Status: Active » Fixed

Committed a fix for this.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

nedjo’s picture

Status: Closed (fixed) » Active

This formatter should support all three data formats, as do the core date formatters. Need to add back 'datetime' and add 'datestamp'. See date_field_formatter_info().

Anonymous’s picture

Ah... just facepalmed on this one again. After upgrading to the dev version and clearing my caches the formatter went away. I had to go into the code of the module and change line 58 back to 'datetime', because that is what my field is using.

Can we support *both* the date and datetime formats?

Anonymous’s picture

...and by both (in #8) I mean all three as mentioned in #7.

tboornaz’s picture

I change line 58 back to 'datetime', because that is what my field is using but I received the following error when I do. I tried to upgrade to the dev version and cleared my cache several times and I am still receiving the error. I even tried uninstalling and reinstalling the module but nothing worked.

Notice: Undefined offset: 0 in addtocal_field_formatter_view() (line 82 of /home/content/84/9602884/html/sites/all/modules/addtocal/addtocal.module).
Warning: array_key_exists() expects parameter 2 to be array, null given in addtocal_extract_event_info() (line 279 of /home/content/84/9602884/html/sites/all/modules/addtocal/addtocal.module).

paulap’s picture

Same problems...

nedjo’s picture

Status: Active » Needs review
FileSize
464 bytes

Attached patch should restore 'date' support and also adds 'datestamp'. I haven't however tested with a datestamp field.

tboornaz’s picture

I just applied the patch cleared my cache. Set add to cal as the format. When I visited the node I received the following error.

Notice: Undefined offset: 0 in addtocal_field_formatter_view() (line 82 of /home/content/84/9602884/html/sites/all/modules/addtocal/addtocal.module).
Warning: array_key_exists() expects parameter 2 to be array, null given in addtocal_extract_event_info() (line 279 of /home/content/84/9602884/html/sites/all/modules/addtocal/addtocal.module).

antipex’s picture

Status: Needs review » Fixed

#13: Thanks - I've applied the patch in 57f8e08.

#14: I believe the error message was due to a lack of content in your date field. I've fixed this in eb3ff00.

tboornaz’s picture

I am sorry I am relatively new to drupal, you indicated that you fixed the problem in eb3ff00 and applied the patch in 578e08. What does that mean? Is that a patch? If so, how do I locate it to apply it? Thanks for your help!

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

BrightBold’s picture

@tboornaz — those refer to the Git commits. If you wait a half-day or so after the fix is committed it usually gets rolled into a new dev version, so downloading the latest dev should get you access this fix.

bandanaman’s picture

Not working with unix timestamp because date variables are unnecessarily converted

replacing

$start_timestamp = strtotime($start . 'UTC');
$end_timestamp = strtotime($end . 'UTC');

with

$start_timestamp = $start;
$end_timestamp = $end;

temporary fixes the problem, but module needs function to recognize date write type.

BrightBold’s picture

Status: Closed (fixed) » Active

@trueapart — don't forget to set the status back to "active" if you need to reopen an issue; otherwise the maintainers may never see your comment.

Simon Georges’s picture

Issue summary: View changes
SocialNicheGuru’s picture

Status: Active » Needs review