You are here

function ds_ds_field_format_summary in Display Suite 7.2

Same name and namespace in other branches
  1. 7 ds.field_ui.inc \ds_ds_field_format_summary()

Implements hook_ds_field_format_summary().

File

includes/ds.field_ui.inc, line 1194
Field UI functions for Display Suite.

Code

function ds_ds_field_format_summary($field) {
  $summary = '';
  $settings = isset($field['formatter_settings']) ? $field['formatter_settings'] : $field['properties']['default'];
  $functions = module_invoke_all('ds_field_theme_functions_info');
  foreach ($settings as $key => $value) {

    // Ignore Field Formatter conditions.
    if ($key == 'conditions') {
      continue;
    }
    if ($key == 'ctools') {
      $conf = unserialize($value);
      $summary .= t('Type: !type', array(
        '!type' => check_plain(drupal_ucfirst(str_replace('_', ' ', $conf['subtype']))),
      ));
    }
    elseif ($key == 'ft' || is_array($value)) {

      // Do nothing
    }
    elseif (!empty($value)) {
      $value = is_numeric($value) ? $value ? t('Yes') : t('No') : check_plain($value);
      $summary .= ' ' . str_replace('_', ' ', drupal_ucfirst(check_plain($key))) . ': ' . check_plain($value) . '<br />';
    }
  }
  if (empty($summary) && $field['field_type'] == DS_FIELD_TYPE_CTOOLS) {
    $summary .= t('Not configured yet.') . '<br />';
  }
  return $summary;
}