You are here

public function TokenCustomController::addForm in Custom Tokens 8

Presents the custom token creation form.

Parameters

\Drupal\token_custom\TokenCustomTypeInterface $token_custom_type: The custom token type to add.

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

Return value

array A form array as expected by drupal_render().

1 call to TokenCustomController::addForm()
TokenCustomController::add in src/Controller/TokenCustomController.php
Displays add custom token links for available types.

File

src/Controller/TokenCustomController.php, line 97

Class

TokenCustomController
Controller for token_custom entity.

Namespace

Drupal\token_custom\Controller

Code

public function addForm(TokenCustomTypeInterface $token_custom_type, Request $request) {
  $token = $this->tokenCustomStorage
    ->create([
    'type' => $token_custom_type
      ->id(),
  ]);
  return $this
    ->entityFormBuilder()
    ->getForm($token);
}