You are here

function hook_date_ical_export_raw_event_alter in Date iCal 7.3

Modify an event's raw data.

This hook is invoked after Date iCal has gathered all the data it will use to build an event object.

Parameters

array $event: A reference to an associative array containing the event's raw data.

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

array $context: Depending on whether this event is being constructed using the Fields or Entity plugins, this context array will have different keys and values.

Entity Plugin:

  • 'entity_type': The type of entity being rendered (e.g. 'node').
  • 'entity': The fully loaded entity being rendered.
  • 'language': The language code that indicates which translation of field data should be used.

Fields Plugin:

  • 'row': The full Views row object being converted to an event.
  • 'row_index': The index into the query results for this view.
  • 'language': The language code that indicates which translation of field data should be used.
  • 'options': The Fields plugin options.
2 invocations of hook_date_ical_export_raw_event_alter()
date_ical_plugin_row_ical_entity::render in includes/date_ical_plugin_row_ical_entity.inc
Renders the entities returned by the view into event arrays.
date_ical_plugin_row_ical_fields::render in includes/date_ical_plugin_row_ical_fields.inc
Returns an Event array row in the query with index: $row->index.

File

./date_ical.api.php, line 75
Documentation for the hooks provided by Date iCal.

Code

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

  // Example: adding a comment to an event from a simple
  // textfield called 'field_comment' (using the Entity plugin).
  if ($comments = field_get_items($context['entity_type'], $context['entity'], 'field_comment', $context['language'])) {
    foreach ($comments as $comment) {
      $event['comment'] = check_plain($comment['value']);
    }
  }

  // Example: Retrieving information from additional fields in the View (using
  // the Fields plugin).
  $event['comment'] = $view->style_plugin
    ->get_field($context['row_index'], 'field_comment');
}