You are here

public function RegistrationController::registrationAdd in RNG - Events and Registrations 8.2

Same name and namespace in other branches
  1. 8 src/Controller/RegistrationController.php \Drupal\rng\Controller\RegistrationController::RegistrationAdd()
  2. 3.x src/Controller/RegistrationController.php \Drupal\rng\Controller\RegistrationController::registrationAdd()

Provides a registration form.

Parameters

\Drupal\Core\Routing\RouteMatchInterface $route_match: The matched route.

string $event: The parameter to find the event entity.

\Drupal\rng\Entity\RegistrationTypeInterface $registration_type: The type of registration.

Return value

array A registration form.

File

src/Controller/RegistrationController.php, line 116

Class

RegistrationController
Controller for registration entities.

Namespace

Drupal\rng\Controller

Code

public function registrationAdd(RouteMatchInterface $route_match, $event, RegistrationTypeInterface $registration_type) {
  $event_entity = $route_match
    ->getParameter($event);
  $registration = Registration::create([
    'type' => $registration_type
      ->id(),
  ]);
  $registration
    ->setEvent($event_entity);
  return $this
    ->entityFormBuilder()
    ->getForm($registration, 'add', [
    $event_entity,
  ]);
}