You are here

public function ConfigPagesController::addForm in Config Pages 8.2

Same name and namespace in other branches
  1. 8.3 src/Controller/ConfigPagesController.php \Drupal\config_pages\Controller\ConfigPagesController::addForm()
  2. 8 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 92

Class

ConfigPagesController
Class controller for ConfigPage entity..

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);
}