You are here

protected function date_ical_plugin_row_ical_fields::get_date_field_candidates in Date iCal 7.3

Same name and namespace in other branches
  1. 7.2 includes/date_ical_plugin_row_ical_fields.inc \date_ical_plugin_row_ical_fields::get_date_field_candidates()

Filter the list of views fields down to only supported date-type fields.

The supported date-type fields are timestamps and the three Date fields.

Parameters

array $view_fields: An associative array like views_plugin_display::get_field_labels().

Return value

array An associative array (alias => label) of date fields.

1 call to date_ical_plugin_row_ical_fields::get_date_field_candidates()
date_ical_plugin_row_ical_fields::options_form in includes/date_ical_plugin_row_ical_fields.inc
Build the form for setting the row plugin's options.

File

includes/date_ical_plugin_row_ical_fields.inc, line 374
Defines the iCal Fields row style plugin, which lets users map view fields to the components of the VEVENTs in the iCal feed.

Class

date_ical_plugin_row_ical_fields
A Views plugin which builds an iCal VEVENT from a views row with Fields.

Code

protected function get_date_field_candidates($view_fields) {
  $handlers = $this->display->handler
    ->get_handlers('field');
  $field_candidates = array();

  // These are Date, Date (ISO format), and Date (Unix timestamp).
  $date_fields = array(
    'datetime',
    'date',
    'datestamp',
  );
  foreach ($view_fields as $alias => $label) {
    $handler_class = get_class($handlers[$alias]);
    if ($handler_class == 'views_handler_field_date' || $handler_class == 'views_handler_field_field' && in_array($handlers[$alias]->field_info['type'], $date_fields)) {
      $field_candidates[$alias] = $label;
    }
  }
  return $field_candidates;
}