public BlockContentController::addForm(BlockContentTypeInterface $block_content_type, Request $request)
Presents the custom block creation form.
Parameters
\Drupal\block_content\BlockContentTypeInterface $block_content_type: The custom block type to add.
\Symfony\Component\HttpFoundation\Request $request: The current request object.
Return value
array A form array as expected by drupal_render().
File
- core/modules/block_content/src/Controller/BlockContentController.php, line 103
Class
Namespace
Drupal\block_content\Controller
Code
1 2 3 4 5 6 7 8 9 10 11 12 | public function addForm(BlockContentTypeInterface $block_content_type , Request $request ) { $block = $this ->blockContentStorage->create( array ( 'type' => $block_content_type ->id() )); if (( $theme = $request ->query->get( 'theme' )) && in_array( $theme , array_keys ( $this ->themeHandler->listInfo()))) { // We have navigated to this page from the block library and will keep track // of the theme for redirecting the user to the configuration page for the // newly created block in the given theme. $block ->setTheme( $theme ); } return $this ->entityFormBuilder()->getForm( $block ); } |
Please login to continue.