You are here

function services_views_field_formatter_settings_summary in Services Views 7

Implements hook_field_formatter_info().

File

./services_views.module, line 369
Provides a generic but powerful API for web services.

Code

function services_views_field_formatter_settings_summary($field, $instance, $view_mode) {
  $display = $instance['display'][$view_mode];
  $settings = $display['settings'];
  $output = array();
  $key = !empty($settings['data_element_key']) ? $settings['data_element_key'] : $instance['label'];
  $skipsafe = isset($settings['skip_safe']) && $settings['skip_safe'] ? t('Yes') : t('No');
  $skipempty = isset($settings['skip_empty_values']) && $settings['skip_empty_values'] ? t('Yes') : t('No');
  $skipformat = isset($settings['skip_text_format']) && $settings['skip_text_format'] ? t('Yes') : t('No');
  $termname = isset($settings['term_name']) && $settings['term_name'] ? t('Yes') : t('No');
  if ($display['type'] == 'services') {
    $output[] = t('Element key: %key', array(
      "%key" => $key,
    ));
    $output[] = t('Skip safe values: %key', array(
      "%key" => $skipsafe,
    ));
    $output[] = t('Skip empty values: %key', array(
      "%key" => $skipempty,
    ));

    // Add text field settings.
    if ($field['module'] == 'text') {
      $output[] = t('Skip text format: %key', array(
        "%key" => $skipformat,
      ));
    }

    // Add taxonomy reference field settings.
    if ($field['module'] == 'taxonomy') {
      $output[] = t('Use term name: %key', array(
        "%key" => $termname,
      ));
    }
    return implode('<br />', $output);
  }
  else {
    return '';
  }
}