function _date_ical_get_summary_fields in Date iCal 7.3
Same name and namespace in other branches
- 7.2 date_ical.module \_date_ical_get_summary_fields()
Internal helper function for date_ical_get_summary_fields().
This is a cut down version of _date_views_fields() from date_views_fields.inc in date_views module.
Return value
array Array with fieldname, type, and table.
See also
date_views_date_views_fields()
1 call to _date_ical_get_summary_fields()
- date_ical_get_summary_fields in ./
date_ical.module - Identify all potential fields which could be used as an iCal SUMMARY.
File
- ./
date_ical.module, line 405 - Adds ical functionality to Views, and an iCal parser to Feeds.
Code
function _date_ical_get_summary_fields($base = 'node') {
// Make sure $base is never empty.
if (empty($base)) {
$base = 'node';
}
$cid = 'date_ical_summary_fields_' . $base;
cache_clear_all($cid, 'cache_views');
// Iterate over all the fields that Views knows about.
$all_fields = date_views_views_fetch_fields($base, 'field');
$fields = array();
foreach ($all_fields as $alias => $val) {
$name = $alias;
$tmp = explode('.', $name);
$field_name = $tmp[1];
$table_name = $tmp[0];
// Skip unsupported field types and fields that weren't defined through
// the Field module.
$info = field_info_field($field_name);
$supported_summary_fields = array(
'text',
'text_long',
'text_with_summary',
'node_reference',
'taxonomy_term_reference',
);
if (!$info || !in_array($info['type'], $supported_summary_fields)) {
continue;
}
// Build an array of the field info that we'll need.
$alias = str_replace('.', '_', $alias);
$fields['name'][$name] = array(
'label' => "{$val['group']}: {$val['title']} ({$field_name})",
'table_name' => $table_name,
'field_name' => $field_name,
'type' => $info['type'],
);
// These are here only to make this $field array conform to the same format
// as the one returned by _date_views_fields(). They're probably not needed,
// but I thought that consistency would be a good idea.
$fields['name'][$name]['real_field_name'] = $field_name;
$fields['alias'][$alias] = $fields['name'][$name];
}
cache_set($cid, $fields, 'cache_views');
return $fields;
}