You are here

function hook_date_ical_feed_event_render_alter in Date iCal 7.2

Modify a structured event before it is rendered to iCal format.

This hook is invoked after the Date iCal module has generated its representation of the event and allows you to modify or add to the representation. Use this hook to set values of iCal fields that are supported but have no values mapped into them by default.

Parameters

$event: An associative array representation of the iCal event. This will be used by the Date iCal rendering system to create an entry in an iCal feed.

$view: The view object that is being executed to render the iCal feed.

$context: An associative array of context, with the following keys and values:

  • 'entity_type': The type of entity being rendered, 'node', 'user' etc.
  • 'entity': The fully loaded entity being rendered.
  • 'language': The language code that indicates which translation of field data should be used.
2 invocations of hook_date_ical_feed_event_render_alter()
date_ical_plugin_row_ical_entity::render in includes/date_ical_plugin_row_ical_entity.inc
Render a row object. This usually passes through to a theme template of some form, but not always.
date_ical_plugin_row_ical_fields::render in includes/date_ical_plugin_row_ical_fields.inc
Returns an Event array based on the query result from the view whose index is specified in the (hidden) second parameter of this function.

File

./date_ical.api.php, line 68

Code

function hook_date_ical_feed_event_render_alter(&$event, $view, $context) {

  // Simple example adding the location to a rendered event from a simple
  // textfield called 'field_location'.
  $entity_type = $context['entity_type'];
  $entity = $context['entity'];
  $language = $context['language'];
  if ($locations = field_get_items($entity_type, $entity, 'field_location', $language)) {
    foreach ($locations as $location) {
      $event['location'] = check_plain($location['value']);
    }
  }
}