Version 1
[yaffs-website] / web / core / modules / block / src / Controller / BlockAddController.php
diff --git a/web/core/modules/block/src/Controller/BlockAddController.php b/web/core/modules/block/src/Controller/BlockAddController.php
new file mode 100644 (file)
index 0000000..973a859
--- /dev/null
@@ -0,0 +1,30 @@
+<?php
+
+namespace Drupal\block\Controller;
+
+use Drupal\Core\Controller\ControllerBase;
+
+/**
+ * Controller for building the block instance add form.
+ */
+class BlockAddController extends ControllerBase {
+
+  /**
+   * Build the block instance add form.
+   *
+   * @param string $plugin_id
+   *   The plugin ID for the block instance.
+   * @param string $theme
+   *   The name of the theme for the block instance.
+   *
+   * @return array
+   *   The block instance edit form.
+   */
+  public function blockAddConfigureForm($plugin_id, $theme) {
+    // Create a block entity.
+    $entity = $this->entityManager()->getStorage('block')->create(['plugin' => $plugin_id, 'theme' => $theme]);
+
+    return $this->entityFormBuilder()->getForm($entity);
+  }
+
+}