You are here

function tablefield_field_formatter_settings_summary in TableField 7.2

Same name and namespace in other branches
  1. 7.3 tablefield.module \tablefield_field_formatter_settings_summary()

Implements hook_field_formatter_settings_summary().

File

./tablefield.module, line 430
Provides a set of fields that can be used to store tabular data with a node.

Code

function tablefield_field_formatter_settings_summary($field, $instance, $view_mode) {
  $display = $instance['display'][$view_mode];
  $settings = $display['settings'];
  $summary = array();
  switch ($display['type']) {
    case 'format_raw':
      $summary[] = t('Use first row/column values as array keys (if not empty): %tr', array(
        '%tr' => $settings['usearraykeys'],
      ));
      $summary[] = t('Vertical header (first column instead of first row): %tr', array(
        '%tr' => $settings['vertheader'] ? t('Yes') : t('No'),
      ));
      $summary[] = t('Table data only (no caption): %tr', array(
        '%tr' => $settings['tabledataonly'] ? t('Yes') : t('No'),
      ));
      break;
    default:
      $summary[] = t('Sticky header: %tr', array(
        '%tr' => $settings['sticky_header'] ? t('Yes') : t('No'),
      ));
      $summary[] = t('Hide table header: %tr', array(
        '%tr' => $settings['hide_header'] ? t('Yes') : t('No'),
      ));
      $summary[] = t('Hide empty columns ignoring column header: %tr', array(
        '%tr' => $settings['hide_cols_skip_head'] ? t('Yes') : t('No'),
      ));
      $summary[] = t('Trim empty trailing rows: %tr', array(
        '%tr' => $settings['trim_trailing_rows'] ? t('Yes') : t('No'),
      ));
      $summary[] = t('Trim empty trailing columns: %tr', array(
        '%tr' => $settings['trim_trailing_cols'] ? t('Yes') : t('No'),
      ));
      $summary[] = t('Hide empty rows: %tr', array(
        '%tr' => $settings['hide_empty_rows'] ? t('Yes') : t('No'),
      ));
      $summary[] = t('Hide empty columns: %tr', array(
        '%tr' => $settings['hide_empty_cols'] ? t('Yes') : t('No'),
      ));
      $permission = l(t('permission'), 'admin/people/permissions', array(
        'fragment' => 'module-tablefield',
        'attributes' => array(
          'title' => t('Manage user permissions'),
        ),
      ));
      $summary[] = t('Show link to export table data as CSV depending on !permission: %tr', array(
        '%tr' => $settings['hide_cols_skip_head'] ? t('Yes') : t('No'),
        '!permission' => $permission,
      ));
  }
  return implode('<br />', $summary);
}