From 781b3da064cddb448bb8bec2400607a505851fc6 Mon Sep 17 00:00:00 2001
From: dagmar <dagmar@154086.no-reply.drupal.org>
Date: Mon, 25 Apr 2016 20:40:41 +0000
Subject: [PATCH] Issue #2712965 by dagmar: Use the selected contact form as
 default option when creating blocks

---
 src/Plugin/Block/ContactBlock.php | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/src/Plugin/Block/ContactBlock.php b/src/Plugin/Block/ContactBlock.php
index 959b66f..5e4324d 100644
--- a/src/Plugin/Block/ContactBlock.php
+++ b/src/Plugin/Block/ContactBlock.php
@@ -82,12 +82,12 @@ class ContactBlock extends BlockBase implements ContainerFactoryPluginInterface
    *   The renderer.
    */
   public function __construct(array $configuration, $plugin_id, $plugin_definition, EntityManager $entity_manager, ConfigFactory $config_factory, EntityFormBuilder $entity_form_builder, Renderer $renderer) {
-    parent::__construct($configuration, $plugin_id, $plugin_definition);
-
     $this->entityManager = $entity_manager;
     $this->configFactory = $config_factory;
     $this->entityFormBuilder = $entity_form_builder;
     $this->renderer = $renderer;
+
+    parent::__construct($configuration, $plugin_id, $plugin_definition);
   }
 
   /**
@@ -139,9 +139,11 @@ class ContactBlock extends BlockBase implements ContainerFactoryPluginInterface
    * {@inheritdoc}
    */
   public function defaultConfiguration() {
+    $default_form = $this->configFactory->get('config.factory')->get('default_form');
+
     return array(
       'label' => t('Contact block'),
-      'contact_form' => 'personal',
+      'contact_form' => $default_form,
     );
   }
 
-- 
1.9.1

