class BlockAddController
Same name and namespace in other branches
- 11.x core/modules/block/src/Controller/BlockAddController.php \Drupal\block\Controller\BlockAddController
Controller for building the block instance add form.
Hierarchy
- class \Drupal\Core\Controller\ControllerBase extends \Drupal\Core\DependencyInjection\ContainerInjectionInterface uses \Drupal\Core\Logger\LoggerChannelTrait, \Drupal\Core\Messenger\MessengerTrait, \Drupal\Core\Routing\RedirectDestinationTrait, \Drupal\Core\StringTranslation\StringTranslationTrait
- class \Drupal\block\Controller\BlockAddController implements \Drupal\Core\Controller\ControllerBase
Expanded class hierarchy of BlockAddController
File
-
core/
modules/ block/ src/ Controller/ BlockAddController.php, line 10
Namespace
Drupal\block\ControllerView source
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->entityTypeManager()
->getStorage('block')
->create([
'plugin' => $plugin_id,
'theme' => $theme,
]);
return $this->entityFormBuilder()
->getForm($entity);
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.