function services_views_field_formatter_view in Services Views 7
Implements hook_field_formatter_view().
File
- ./
services_views.module, line 405 - Provides a generic but powerful API for web services.
Code
function services_views_field_formatter_view($entity_type, $entity, $field, $instance, $langcode, $items, $display) {
$settings = $display['settings'];
$element = array();
static $i = 0;
if ($display['type'] == 'services') {
foreach ($items as $delta => $item) {
// Apply the settings filters.
$filtered_item = array();
foreach ($item as $key => $val) {
if ($settings['skip_safe'] && $key == 'safe_value') {
continue;
}
if ($settings['skip_empty_values'] && empty($val)) {
continue;
}
if ($settings['skip_text_format'] && $key == 'format') {
continue;
}
if ($settings['term_name'] && $key == 'tid') {
$term = taxonomy_term_load($val);
$val = $term->name;
$key = count($filtered_item);
}
$filtered_item[$key] = $val;
}
$element[$delta] = $filtered_item;
}
}
return $element;
}