From 7a0e49a8b80e9bc5ae485e32588b2c5af6659c8e Mon Sep 17 00:00:00 2001
From: GoZ <goz@226961.no-reply.drupal.org>
Date: Sun, 20 Dec 2015 12:53:59 +0100
Subject: [PATCH] Issue #2633912 by GoZ: Default country widget summary

---
 src/Plugin/Field/FieldWidget/AddressDefaultWidget.php | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/src/Plugin/Field/FieldWidget/AddressDefaultWidget.php b/src/Plugin/Field/FieldWidget/AddressDefaultWidget.php
index 4cd35ed..31bfe9d 100644
--- a/src/Plugin/Field/FieldWidget/AddressDefaultWidget.php
+++ b/src/Plugin/Field/FieldWidget/AddressDefaultWidget.php
@@ -170,6 +170,25 @@ class AddressDefaultWidget extends WidgetBase implements ContainerFactoryPluginI
   }
 
   /**
+   * {@inheritdoc}
+   */
+  public function settingsSummary() {
+    $summary = [];
+    // Load country list to display full country name.
+    $country_list = $this->countryRepository->getList();
+
+    // Display summary for default country setting.
+    $default_country = $this->getSetting('default_country');
+    if (empty($default_country)) {
+      $summary['default_country'] = $this->t('Default country: @country', array('@country' => 'None'));
+    }
+    else {
+      $summary['default_country'] = $this->t('Default country: @country', array('@country' => $country_list[$default_country]));
+    }
+    return $summary;
+  }
+
+  /**
    * Gets the initial values for the widget.
    *
    * This is a replacement for the disabled default values functionality.
-- 
2.5.4 (Apple Git-61)

