You are here

function addtocal_yahoo_link in Add to Cal 7

Redirects to a Yahoo Calendar event. Called by hook_menu().

Parameters

$entity:

$field_name:

$view_mode:

1 string reference to 'addtocal_yahoo_link'
addtocal_menu in ./addtocal.module
Implements hook_menu().

File

./addtocal.module, line 676
addtocal.module General functions and hook implementations.

Code

function addtocal_yahoo_link($entity, $field_name, $view_mode) {

  // Get entity type from the current path
  $entity_type = arg(0);
  list($entity_id) = entity_extract_ids($entity_type, $entity);
  $display = addtocal_get_display($entity, $entity_type, $field_name, $view_mode);
  $info = addtocal_extract_event_info($entity_type, $entity, $entity_id, $field_name, $display);
  $rfc_dates = addtocal_rfc_3339_date($info['start'], $info['end'], $info['timezone']);
  $yahoo_url = url('http://calendar.yahoo.com/', array(
    'query' => array(
      'v' => 60,
      'TITLE' => $info['title'],
      'ST' => $rfc_dates['start'],
      'ET' => $rfc_dates['end'],
      'URL' => $_SERVER['HTTP_HOST'],
      'in_loc' => $info['location'],
      'desc' => $info['description'],
    ),
  ));
  drupal_goto($yahoo_url);
}