You are here

function field_orbit_field_formatter_settings_summary in ZURB Orbit 7

Same name and namespace in other branches
  1. 7.2 field_orbit.module \field_orbit_field_formatter_settings_summary()

Implements hook_field_formatter_settings_summary().

File

./field_orbit.module, line 222
Implement a orbit formatter for fields.

Code

function field_orbit_field_formatter_settings_summary($field, $instance, $view_mode) {
  $display = $instance['display'][$view_mode];
  $settings = $display['settings'];
  $summary = array();
  $summary[] = t('Transition effect: @effect', array(
    '@effect' => $settings['animation'],
  ));
  $summary[] = t('Speed: @speedms', array(
    '@speed' => $settings['animationSpeed'],
  ));
  $summary[] = t('Show timer: @timer', array(
    '@timer' => $settings['timer'] ? 'yes' : 'no',
  ));
  $summary[] = t('Reset timer on click: @reset', array(
    '@reset' => $settings['resetTimerOnClick'] ? 'yes' : 'no',
  ));
  $summary[] = t('Advance speed: @speedms', array(
    '@speed' => $settings['advanceSpeed'],
  ));
  $summary[] = t('Pause on hover: @pause', array(
    '@pause' => $settings['pauseOnHover'] ? 'yes' : 'no',
  ));
  $summary[] = t('Start clock on mouseOut: @start', array(
    '@start' => $settings['startClockOnMouseOut'] ? 'yes' : 'no',
  ));
  $summary[] = t('Start clock on mouseOut after: @startms', array(
    '@start' => $settings['startClockOnMouseOutAfter'],
  ));
  $summary[] = t('Directional nav: @directionalNav', array(
    '@directionalNav' => $settings['directionalNav'] ? 'yes' : 'no',
  ));
  $summary[] = t('Show captions: @captions', array(
    '@captions' => $settings['captions'] ? 'yes' : 'no',
  ));
  $summary[] = t('Caption animation: @animation', array(
    '@animation' => $settings['captionAnimation'],
  ));
  $summary[] = t('Caption animation speed: @speedms', array(
    '@speed' => $settings['captionAnimationSpeed'],
  ));
  $summary[] = t('Bullets: @bullets', array(
    '@bullets' => $settings['bullets'] ? 'yes' : 'no',
  ));
  $summary[] = t('Bullet thumbnails: @thumbs', array(
    '@thumbs' => $settings['bulletThumbs'] ? 'yes' : 'no',
  ));
  $summary[] = t('Bullet thumb location: @location', array(
    '@location' => $settings['bulletThumbLocation'],
  ));
  $summary[] = t('Fluid: @fluid', array(
    '@fluid' => $settings['fluid'] ? 'yes' : 'no',
  ));
  $image_styles = image_style_options(FALSE);

  // Unset possible 'No defined styles' option.
  unset($image_styles['']);

  // Styles could be lost because of enabled/disabled modules that defines
  // their styles in code.
  if (isset($image_styles[$settings['orbit_image_style']])) {
    $summary[] = t('Image style: @style', array(
      '@style' => $image_styles[$settings['orbit_image_style']],
    ));
  }
  else {
    $summary[] = t('Original image');
  }
  $link_types = array(
    'content' => t('content'),
    'file' => t('file'),
  );
  if ($field['type'] == 'media' || $field['type'] == 'field_collection') {
    $link_types += _field_orbit_get_fields(array(
      'link_field',
      'node_reference',
    ), $field['type'], $field['field_name']);
  }

  // Display this setting only if image is linked.
  if (isset($link_types[$settings['orbit_link']])) {
    $link_type_message = t('Link to: @link', array(
      '@link' => $link_types[$settings['orbit_link']],
    ));
    $summary[] = $link_type_message;
  }
  if ($field['type'] == 'media' || $field['type'] == 'field_collection') {
    $caption_types = _field_orbit_get_fields(array(
      'text',
    ), $field['type'], $field['field_name']);
  }
  else {
    $caption_types = array(
      'title' => t('Title text'),
      'alt' => t('Alt text'),
    );
  }

  // Display this setting only if there's a caption.
  if (isset($caption_types[$settings['orbit_caption']])) {
    $caption_message = t('Caption: @caption', array(
      '@caption' => $caption_types[$settings['orbit_caption']],
    ));
    if (isset($link_types[$settings['orbit_caption_link']])) {
      $caption_message .= ' (' . t('Link to: @link', array(
        '@link' => $link_types[$settings['orbit_caption_link']],
      )) . ')';
    }
    $summary[] = $caption_message;
  }
  return implode('<br />', $summary);
}