You are here

function faqfield_field_formatter_settings_summary in FAQ Field 7

Implements hook_field_formatter_settings_summary().

File

./faqfield.module, line 233
FAQ Field Provides a field for frequently asked questions.

Code

function faqfield_field_formatter_settings_summary($field, $instance, $view_mode) {
  $display = $instance['display'][$view_mode];
  $settings = $display['settings'];
  $summary = '';
  switch ($display['type']) {

    // Accordion display settings summary.
    case 'faqfield_accordion':
      $summary_elements = array();
      if ($settings['active'] !== '') {
        $summary_elements[] = t('Active: @element', array(
          '@element' => $settings['active'],
        ));
      }
      if ($settings['autoHeight']) {
        $summary_elements[] = t('Auto height');
      }
      if ($settings['collapsible']) {
        $summary_elements[] = t('Collapsible');
      }
      $summary_elements[] = t('Event: @event', array(
        '@event' => $settings['event'],
      ));
      $summary = implode(', ', $summary_elements);
      break;

    // Anchor list formatter settings.
    case 'faqfield_anchor_list':
      $summary_elements = array();
      if ($settings['anchor-list-type'] == 'ul') {
        $summary_elements[] = t('Bullet list');
      }
      else {
        $summary_elements[] = t('Numeric list');
      }
      $summary = implode(', ', $summary_elements);
      break;
  }
  return $summary;
}