Mercurial > hg > cmmr2012-drupal-site
diff core/modules/block/src/Controller/BlockAddController.php @ 0:c75dbcec494b
Initial commit from drush-created site
author | Chris Cannam |
---|---|
date | Thu, 05 Jul 2018 14:24:15 +0000 |
parents | |
children | 12f9dff5fda9 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/core/modules/block/src/Controller/BlockAddController.php Thu Jul 05 14:24:15 2018 +0000 @@ -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); + } + +}