Version 1
[yaffs-website] / web / core / modules / block / src / Controller / BlockAddController.php
1 <?php
2
3 namespace Drupal\block\Controller;
4
5 use Drupal\Core\Controller\ControllerBase;
6
7 /**
8  * Controller for building the block instance add form.
9  */
10 class BlockAddController extends ControllerBase {
11
12   /**
13    * Build the block instance add form.
14    *
15    * @param string $plugin_id
16    *   The plugin ID for the block instance.
17    * @param string $theme
18    *   The name of the theme for the block instance.
19    *
20    * @return array
21    *   The block instance edit form.
22    */
23   public function blockAddConfigureForm($plugin_id, $theme) {
24     // Create a block entity.
25     $entity = $this->entityManager()->getStorage('block')->create(['plugin' => $plugin_id, 'theme' => $theme]);
26
27     return $this->entityFormBuilder()->getForm($entity);
28   }
29
30 }