You are here

public function MailchimpListsSubscribeDefaultFormatter::settingsSummary in Mailchimp 8

Same name and namespace in other branches
  1. 2.x modules/mailchimp_lists/src/Plugin/Field/FieldFormatter/MailchimpListsSubscribeDefaultFormatter.php \Drupal\mailchimp_lists\Plugin\Field\FieldFormatter\MailchimpListsSubscribeDefaultFormatter::settingsSummary()

Returns a short summary for the current formatter settings.

If an empty result is returned, a UI can still be provided to display a settings form in case the formatter has configurable settings.

Return value

string[] A short summary of the formatter settings.

Overrides FormatterBase::settingsSummary

File

modules/mailchimp_lists/src/Plugin/Field/FieldFormatter/MailchimpListsSubscribeDefaultFormatter.php, line 56

Class

MailchimpListsSubscribeDefaultFormatter
Plugin implementation of the 'mailchimp_lists_subscribe_default' formatter.

Namespace

Drupal\mailchimp_lists\Plugin\Field\FieldFormatter

Code

public function settingsSummary() {
  $field_settings = $this
    ->getFieldSettings();
  $settings = $this
    ->getSettings();
  $summary = [];
  if ($field_settings['show_interest_groups'] && $settings['show_interest_groups']) {
    $summary[] = $this
      ->t('Display Interest Groups');
  }
  else {
    $summary[] = $this
      ->t('Hide Interest Groups');
  }
  return $summary;
}