You are here

function user_reference_field_formatter_settings_summary in References 7.2

Implements hook_field_formatter_settings_summary().

File

user_reference/user_reference.module, line 356
Defines a field type for referencing a user from a node.

Code

function user_reference_field_formatter_settings_summary($field, $instance, $view_mode) {
  $display = $instance['display'][$view_mode];
  $settings = $display['settings'];
  $summary = array();
  switch ($display['type']) {
    case 'user_reference_user':
      $entity_info = entity_get_info('user');
      $modes = $entity_info['view modes'];
      $mode = $modes[$settings['user_reference_view_mode']]['label'];
      $summary[] = t('View mode: %mode', array(
        '%mode' => $mode,
      ));
      break;
    case 'user_reference_path':
      $summary[] = t('Aliased path: %yes_no', array(
        '%yes_no' => $settings['alias'] ? t('Yes') : t('No'),
      ));
      $summary[] = t('Absolute URL: %yes_no', array(
        '%yes_no' => $settings['absolute'] ? t('Yes') : t('No'),
      ));
      break;
  }
  return implode('<br />', $summary);
}