annotate core/modules/block/src/Controller/BlockAddController.php @ 19:fa3358dc1485 tip

Add ndrum files
author Chris Cannam
date Wed, 28 Aug 2019 13:14:47 +0100
parents af1871eacc83
children
rev   line source
Chris@0 1 <?php
Chris@0 2
Chris@0 3 namespace Drupal\block\Controller;
Chris@0 4
Chris@0 5 use Drupal\Core\Controller\ControllerBase;
Chris@0 6
Chris@0 7 /**
Chris@0 8 * Controller for building the block instance add form.
Chris@0 9 */
Chris@0 10 class BlockAddController extends ControllerBase {
Chris@0 11
Chris@0 12 /**
Chris@0 13 * Build the block instance add form.
Chris@0 14 *
Chris@0 15 * @param string $plugin_id
Chris@0 16 * The plugin ID for the block instance.
Chris@0 17 * @param string $theme
Chris@0 18 * The name of the theme for the block instance.
Chris@0 19 *
Chris@0 20 * @return array
Chris@0 21 * The block instance edit form.
Chris@0 22 */
Chris@0 23 public function blockAddConfigureForm($plugin_id, $theme) {
Chris@0 24 // Create a block entity.
Chris@18 25 $entity = $this->entityTypeManager()->getStorage('block')->create(['plugin' => $plugin_id, 'theme' => $theme]);
Chris@0 26
Chris@0 27 return $this->entityFormBuilder()->getForm($entity);
Chris@0 28 }
Chris@0 29
Chris@0 30 }