You are here

function zurb_twentytwenty_field_formatter_settings_summary in ZURB TwentyTwenty 7

Implementation of hook_field_formatter_settings_summary().

Parameters

$field:

$instance:

$view_mode:

Return value

string

File

./zurb_twentytwenty.module, line 82

Code

function zurb_twentytwenty_field_formatter_settings_summary($field, $instance, $view_mode) {
  $display = $instance['display'][$view_mode];
  $settings = $display['settings'];
  $image_styles = image_style_options(FALSE);
  unset($image_styles['']);
  $summary = array();

  // Styles could be lost because of enabled/disabled modules that defines
  // their styles in code.
  if (isset($image_styles[$settings['image_style']])) {
    $summary[] = t('Image style: @value', array(
      '@value' => $settings['image_style'],
    ));
  }
  else {
    $summary[] = t('Original image');
  }
  if (isset($settings['default_offset_pct'])) {
    $summary[] = t('Default offset: @value', array(
      '@value' => $settings['default_offset_pct'],
    ));
  }
  if ($field['cardinality'] != 2) {
    $summary[] = t('<strong>This image field needs to accept two images to be able to run TwentyTwenty properly, it is currently set to @value.</strong>', array(
      '@value' => $field['cardinality'] > 0 ? $field['cardinality'] : 'unlimited',
    ));
  }
  return implode('<br />', $summary);
}