You are here

public function ConfigPagesController::addForm in Config Pages 8

Same name and namespace in other branches
  1. 8.3 src/Controller/ConfigPagesController.php \Drupal\config_pages\Controller\ConfigPagesController::addForm()
  2. 8.2 src/Controller/ConfigPagesController.php \Drupal\config_pages\Controller\ConfigPagesController::addForm()

Presents the config page creation form.

Parameters

\Drupal\config_pages\ConfigPagesTypeInterface $config_pages_type: The config page type to add.

\Symfony\Component\HttpFoundation\Request $request: The current request object.

Return value

array A form array as expected by drupal_render().

File

src/Controller/ConfigPagesController.php, line 87

Class

ConfigPagesController

Namespace

Drupal\config_pages\Controller

Code

public function addForm(ConfigPagesTypeInterface $config_pages_type, Request $request) {
  $config_page = $this->ConfigPagesStorage
    ->create([
    'type' => $config_pages_type
      ->id(),
  ]);
  return $this
    ->entityFormBuilder()
    ->getForm($config_page);
}