commit ad3f339183d49388fa20f14714df88c4736788b7
Author: yanniboi <yan@yanniboi.com>
Date:   Tue Mar 15 16:58:11 2016 +0000

    hangouts dev by EclipseGc.

diff --git a/src/Form/LayoutPluginSelector.php b/src/Form/LayoutPluginSelector.php
new file mode 100644
index 0000000..b38e06f
--- /dev/null
+++ b/src/Form/LayoutPluginSelector.php
@@ -0,0 +1,56 @@
+<?php
+/**
+ * @file
+ * Contains LayoutPluginSelector.php
+ */
+
+namespace Drupal\panels\Form;
+
+
+use Drupal\Core\Form\FormBase;
+use Drupal\Core\Form\FormStateInterface;
+use Drupal\layout_plugin\Plugin\Layout\LayoutPluginManagerInterface;
+use Symfony\Component\DependencyInjection\ContainerInterface;
+
+class LayoutPluginSelector extends FormBase {
+
+  /**
+   * @var \Drupal\layout_plugin\Plugin\Layout\LayoutPluginManagerInterface
+   */
+  protected $manager;
+
+  public static function create(ContainerInterface $container) {
+    return new static($container->get('plugin.manager.layout_plugin'));
+  }
+
+  public function __construct(LayoutPluginManagerInterface $manager) {
+    $this->manager = $manager;
+  }
+
+  public function getFormId() {
+    return 'panels_layout_selection_form';
+  }
+
+  public function buildForm(array $form, FormStateInterface $form_state) {
+    $cached_values = $form_state->getTemporaryValue('wizard');
+    $variant_plugin = $cached_values['plugin'];
+    $options = [];
+    foreach ($this->manager->getDefinitions() as $plugin_id => $definition) {
+      $options[$plugin_id] = $definition['label'];
+    }
+    $form['layout'] = [
+      '#title' => $this->t('Choose a layout'),
+      '#type' => 'select',
+      '#options' => $options,
+      '#default_value' => $variant_plugin->getConfiguration()['layout'],
+    ];
+    return $form;
+  }
+
+  public function submitForm(array &$form, FormStateInterface $form_state) {
+    $cached_values = $form_state->getTemporaryValue('wizard');
+    $variant_plugin = $cached_values['plugin'];
+    $variant_plugin->setLayout($form_state->getValue('layout'));
+  }
+
+}
diff --git a/src/Plugin/DisplayVariant/PanelsDisplayVariant.php b/src/Plugin/DisplayVariant/PanelsDisplayVariant.php
index aa34cf2..bede134 100644
--- a/src/Plugin/DisplayVariant/PanelsDisplayVariant.php
+++ b/src/Plugin/DisplayVariant/PanelsDisplayVariant.php
@@ -17,11 +17,13 @@ use Drupal\Core\Form\FormStateInterface;
 use Drupal\Core\Plugin\Context\ContextHandlerInterface;
 use Drupal\Core\Session\AccountInterface;
 use Drupal\Core\Utility\Token;
-use Drupal\ctools\Plugin\BlockPluginCollection;
 use Drupal\ctools\Plugin\DisplayVariant\BlockDisplayVariant;
+use Drupal\ctools\Plugin\PluginWizardInterface;
 use Drupal\layout_plugin\Layout;
 use Drupal\layout_plugin\Plugin\Layout\LayoutInterface;
 use Drupal\layout_plugin\Plugin\Layout\LayoutPluginManagerInterface;
+use Drupal\page_manager_ui\Form\VariantPluginContentForm;
+use Drupal\panels\Form\LayoutPluginSelector;
 use Drupal\panels\Plugin\DisplayBuilder\DisplayBuilderInterface;
 use Drupal\panels\Plugin\DisplayBuilder\DisplayBuilderManagerInterface;
 use Symfony\Component\DependencyInjection\ContainerInterface;
@@ -34,7 +36,20 @@ use Symfony\Component\DependencyInjection\ContainerInterface;
  *   admin_label = @Translation("Panels")
  * )
  */
-class PanelsDisplayVariant extends BlockDisplayVariant {
+class PanelsDisplayVariant extends BlockDisplayVariant implements PluginWizardInterface {
+
+  public function getWizardOperations($cached_values) {
+    return [
+      'layout' => [
+        'title' => $this->t('Layout'),
+        'form' => LayoutPluginSelector::class
+      ],
+      'content' => [
+        'title' => $this->t('Content'),
+        'form' => VariantPluginContentForm::class
+      ]
+    ];
+  }
 
   /**
    * The module handler.
