You are here

function ffc_field_formatter_settings_summary_alter in Field formatter conditions 7

Implements hook_field_formatter_settings_summary_alter().

File

./ffc.module, line 41
Field formatter conditions.

Code

function ffc_field_formatter_settings_summary_alter(&$summary, $context) {

  // Check if this is a Display Suite field.
  $ds = !empty($context['ds']);

  // Get settings.
  if ($ds) {
    $settings['conditions'] = array();
    if (!empty($context['field']['formatter_settings']['conditions'])) {
      $settings['conditions'] = $context['field']['formatter_settings']['conditions'];
    }
  }
  else {
    $display = $context['instance']['display'][$context['view_mode']];
    $settings = $display['settings'];
  }
  $break = empty($summary) || $ds ? '' : '<br />';
  if (empty($settings['conditions'])) {
    $summary .= $break . t('No conditions.');
  }
  else {
    $summary .= $break . t('Conditions configured.');
  }
}