You are here

FrontendEnvironmentAddController.php in Build Hooks 8.2

Same filename and directory in other branches
  1. 3.x src/Controller/FrontendEnvironmentAddController.php

File

src/Controller/FrontendEnvironmentAddController.php
View source
<?php

namespace Drupal\build_hooks\Controller;

use Drupal\Core\Controller\ControllerBase;

/**
 * Controller for building the block instance add form.
 */
class FrontendEnvironmentAddController extends ControllerBase {

  /**
   * Add the Frontend environment form.
   *
   * @param string $plugin_id
   *   The plugin id of the frontend environment.
   *
   * @return array
   *   The form to add and configure a frontend environment entity.
   *
   * @throws \Drupal\Component\Plugin\Exception\InvalidPluginDefinitionException
   * @throws \Drupal\Component\Plugin\Exception\PluginNotFoundException
   */
  public function frontendEnvironmentAddConfigureForm($plugin_id) {

    // Create a frontend environment entity.
    $entity = $this
      ->entityTypeManager()
      ->getStorage('frontend_environment')
      ->create([
      'plugin' => $plugin_id,
    ]);
    return $this
      ->entityFormBuilder()
      ->getForm($entity);
  }

}

Classes

Namesort descending Description
FrontendEnvironmentAddController Controller for building the block instance add form.