You are here

public function EnrollRequestDialogController::enrollDialog in Open Social 8.9

Same name and namespace in other branches
  1. 10.3.x modules/social_features/social_event/src/Controller/EnrollRequestDialogController.php \Drupal\social_event\Controller\EnrollRequestDialogController::enrollDialog()
  2. 10.0.x modules/social_features/social_event/src/Controller/EnrollRequestDialogController.php \Drupal\social_event\Controller\EnrollRequestDialogController::enrollDialog()
  3. 10.1.x modules/social_features/social_event/src/Controller/EnrollRequestDialogController.php \Drupal\social_event\Controller\EnrollRequestDialogController::enrollDialog()
  4. 10.2.x modules/social_features/social_event/src/Controller/EnrollRequestDialogController.php \Drupal\social_event\Controller\EnrollRequestDialogController::enrollDialog()

Enroll dialog callback.

1 string reference to 'EnrollRequestDialogController::enrollDialog'
social_event.routing.yml in modules/social_features/social_event/social_event.routing.yml
modules/social_features/social_event/social_event.routing.yml

File

modules/social_features/social_event/src/Controller/EnrollRequestDialogController.php, line 80

Class

EnrollRequestDialogController
Contains methods for the modal form when requesting to enroll in an event.

Namespace

Drupal\social_event\Controller

Code

public function enrollDialog() {
  $response = new AjaxResponse();

  // Get the modal form using the form builder.
  $form = $this->formBuilder
    ->getForm('Drupal\\social_event\\Form\\EnrollRequestModalForm');
  if ($this
    ->currentUser()
    ->isAnonymous()) {
    $form = $this->formBuilder
      ->getForm('Drupal\\social_event\\Form\\EnrollRequestAnonymousForm');
    $response
      ->addCommand(new OpenModalDialogCommand($this
      ->t('Request to enroll'), $form, [
      'width' => '337px',
      'closeOnEscape' => TRUE,
      'dialogClass' => 'social_event-popup social_event-popup--anonymous',
    ]));
  }
  else {
    $response
      ->addCommand(new OpenModalDialogCommand($this
      ->t('Request to enroll'), $form, static::getDataDialogOptions()));
  }
  return $response;
}