You are here

function email_contact_field_formatter_settings_summary in Email Contact 7

Implements hook_field_formatter_settings_summary().

File

./email_contact.module, line 146
File name: email_contact.module.

Code

function email_contact_field_formatter_settings_summary($field, $instance, $view_mode) {
  $display = $instance['display'][$view_mode];
  $settings = $display['settings'];
  $summary = '';
  if ($display['type'] == 'email_contact_inline') {
    $summary = t('Displays a contact form for this email.');
  }
  else {
    $summary .= t('Displays a link to a contact form.');
  }
  $redir = t('Redirection is not set');
  if (!empty($settings['redirection_to'])) {
    switch ($settings['redirection_to']) {
      case 'front':
        $redir = t('Redirection after submit to the site front page.');
        break;
      case 'current':
        $redir = 'Redirection after submit to the current page.';
        break;
      case 'custom':
        $redir = t('Redirection after submit to a custom url: @url', array(
          '@url' => $settings['custom_path'],
        ));
        break;
    }
  }
  $summary .= '<br />' . $redir;
  return $summary;
}