You are here

public function RegistrationController::RegistrationAdd in RNG - Events and Registrations 8

Same name and namespace in other branches
  1. 8.2 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\RegistrationTypeInterface $registration_type: The type of registration.

Return value

array A registration form.

File

src/Controller/RegistrationController.php, line 115

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', array(
    $event_entity,
  ));
}