Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x

BlockAddController.php

Namespace

Drupal\block\Controller

File

core/modules/block/src/Controller/BlockAddController.php

View source
<?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->entityTypeManager()
            ->getStorage('block')
            ->create([
            'plugin' => $plugin_id,
            'theme' => $theme,
        ]);
        return $this->entityFormBuilder()
            ->getForm($entity);
    }

}

Classes

Title Deprecated Summary
BlockAddController Controller for building the block instance add form.

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal