You are here

function field_orbit_field_formatter_settings_summary in ZURB Orbit 7.2

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

Implements hook_field_formatter_settings_summary().

File

./field_orbit.module, line 316
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('Animation: @effect', array(
    '@effect' => $settings['animation'],
  ));
  $summary[] = t('Timer speed: @speedms', array(
    '@speed' => $settings['timer_speed'],
  ));
  $summary[] = t('Pause on hover: @pause', array(
    '@pause' => $settings['pause_on_hover'] ? 'yes' : 'no',
  ));
  $summary[] = t('Resume on mouseOut: @start', array(
    '@start' => $settings['resume_on_mouseout'] ? 'yes' : 'no',
  ));
  $summary[] = t('Animation speed: @speedms', array(
    '@speed' => $settings['animation_speed'],
  ));
  $summary[] = t('Stack on small: @stack', array(
    '@stack' => $settings['stack_on_small'] ? 'yes' : 'no',
  ));
  $summary[] = t('Navigation arrows: @arrow', array(
    '@arrow' => $settings['navigation_arrows'] ? 'yes' : 'no',
  ));
  $summary[] = t('Slide numbers: @number', array(
    '@number' => $settings['slide_number'] ? 'yes' : 'no',
  ));
  $summary[] = t('Container class: @class', array(
    '@class' => $settings['container_class'],
  ));
  $summary[] = t('Stack on small class: @class', array(
    '@class' => $settings['stack_on_small_class'],
  ));
  $summary[] = t('Next arrow class: @class', array(
    '@class' => $settings['next_class'],
  ));
  $summary[] = t('Previous arrow class: @class', array(
    '@class' => $settings['prev_class'],
  ));
  $summary[] = t('Timer container class: @class', array(
    '@class' => $settings['timer_container_class'],
  ));
  $summary[] = t('Timer paused class: @class', array(
    '@class' => $settings['timer_paused_class'],
  ));
  $summary[] = t('Timer progress class: @class', array(
    '@class' => $settings['timer_progress_class'],
  ));
  $summary[] = t('Slide container class: @class', array(
    '@class' => $settings['slides_container_class'],
  ));
  $summary[] = t('Bullet container class: @class', array(
    '@class' => $settings['bullets_container_class'],
  ));
  $summary[] = t('Bullet active class: @class', array(
    '@class' => $settings['bullets_active_class'],
  ));
  $summary[] = t('Slide number class: @class', array(
    '@class' => $settings['slide_number_class'],
  ));
  $summary[] = t('Caption class: @class', array(
    '@class' => $settings['caption_class'],
  ));
  $summary[] = t('Active slide class: @class', array(
    '@class' => $settings['active_slide_class'],
  ));
  $summary[] = t('Orbit transition class: @class', array(
    '@class' => $settings['orbit_transition_class'],
  ));
  $summary[] = t('Bullets: @bullets', array(
    '@bullets' => $settings['bullets'] ? 'yes' : 'no',
  ));
  $summary[] = t('Timer: @timer', array(
    '@timer' => $settings['timer'] ? 'yes' : 'no',
  ));
  $summary[] = t('Variable height: @height', array(
    '@height' => $settings['variable_height'],
  ));
  $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'] == 'file') {
    $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'] == 'file') {
    $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);
}