You are here

function tablefield_field_formatter_settings_summary in TableField 7.3

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

Implements hook_field_formatter_settings_summary().

File

./tablefield.module, line 639
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('Wrapper for table data (if applicable): %tr', array(
        '%tr' => $settings['tabledatakey'],
      ));
      $summary[] = t('Use first row/column values as keys (if not empty): %tr', array(
        '%tr' => $settings['usearraykeys'],
      ));
      if ($settings['usearraykeys'] === 'Both') {
        $summary[] = t('Row identifier key: %tr', array(
          '%tr' => t('Disabled'),
        ));
      }
      else {
        $summary[] = t('Row identifier key: %tr', array(
          '%tr' => $settings['rowkey'] ? t('Yes') : t('No'),
        ));
      }
      $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'),
      ));
      if ($settings['xml']) {
        $summary[] = t('Encode numeric strings as numbers: %tr', array(
          '%tr' => t('Disabled'),
        ));
      }
      else {
        $summary[] = t('Encode numeric strings as numbers: %tr', array(
          '%tr' => $settings['numeric_check'] ? t('Yes') : t('No'),
        ));
      }
      $summary[] = t('XML instead of JSON: %tr', array(
        '%tr' => $settings['xml'] ? t('Yes') : t('No'),
      ));
      if (!$settings['xml']) {
        $summary[] = t('How to make field values XML safe?: %tr', array(
          '%tr' => t('Disabled'),
        ));
      }
      else {
        $summary[] = t('How to make field values XML safe?: %tr', array(
          '%tr' => $settings['xml_safe'],
        ));
      }
      break;
    default:
      $summary[] = t('Sticky header: %tr', array(
        '%tr' => $settings['sticky_header'] ? t('Yes') : t('No'),
      ));
      $summary[] = t('Striping (odd/even class): %tr', array(
        '%tr' => $settings['striping'] ? t('Yes') : t('No'),
      ));
      $summary[] = t('Sortable: %tr', array(
        '%tr' => $settings['sortable'] ? t('Yes') : t('No'),
      ));
      $summary[] = t('Hide first row: %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'),
        ),
      ));
      $table_custom_class_attributes = isset($settings['table_custom_class_attributes']) ? $settings['table_custom_class_attributes'] : NULL;
      $summary[] = t('Add custom class attribute classes to table html element: %tr', array(
        '%tr' => $table_custom_class_attributes,
      ));
      $summary[] = t('Show link to export table data as CSV depending on !permission: %tr', array(
        '%tr' => $settings['export_csv'] ? t('Yes') : t('No'),
        '!permission' => $permission,
      ));
  }
  return implode('<br />', $summary);
}