You are here

public function EventAnEnrollController::enrollDialog in Open Social 10.2.x

Same name and namespace in other branches
  1. 8.9 modules/social_features/social_event/modules/social_event_an_enroll/src/Controller/EventAnEnrollController.php \Drupal\social_event_an_enroll\Controller\EventAnEnrollController::enrollDialog()
  2. 8.3 modules/social_features/social_event/modules/social_event_an_enroll/src/Controller/EventAnEnrollController.php \Drupal\social_event_an_enroll\Controller\EventAnEnrollController::enrollDialog()
  3. 8.4 modules/social_features/social_event/modules/social_event_an_enroll/src/Controller/EventAnEnrollController.php \Drupal\social_event_an_enroll\Controller\EventAnEnrollController::enrollDialog()
  4. 8.5 modules/social_features/social_event/modules/social_event_an_enroll/src/Controller/EventAnEnrollController.php \Drupal\social_event_an_enroll\Controller\EventAnEnrollController::enrollDialog()
  5. 8.6 modules/social_features/social_event/modules/social_event_an_enroll/src/Controller/EventAnEnrollController.php \Drupal\social_event_an_enroll\Controller\EventAnEnrollController::enrollDialog()
  6. 8.7 modules/social_features/social_event/modules/social_event_an_enroll/src/Controller/EventAnEnrollController.php \Drupal\social_event_an_enroll\Controller\EventAnEnrollController::enrollDialog()
  7. 8.8 modules/social_features/social_event/modules/social_event_an_enroll/src/Controller/EventAnEnrollController.php \Drupal\social_event_an_enroll\Controller\EventAnEnrollController::enrollDialog()
  8. 10.3.x modules/social_features/social_event/modules/social_event_an_enroll/src/Controller/EventAnEnrollController.php \Drupal\social_event_an_enroll\Controller\EventAnEnrollController::enrollDialog()
  9. 10.0.x modules/social_features/social_event/modules/social_event_an_enroll/src/Controller/EventAnEnrollController.php \Drupal\social_event_an_enroll\Controller\EventAnEnrollController::enrollDialog()
  10. 10.1.x modules/social_features/social_event/modules/social_event_an_enroll/src/Controller/EventAnEnrollController.php \Drupal\social_event_an_enroll\Controller\EventAnEnrollController::enrollDialog()

Enroll dialog callback.

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

File

modules/social_features/social_event/modules/social_event_an_enroll/src/Controller/EventAnEnrollController.php, line 98

Class

EventAnEnrollController
Class EventAnEnrollController.

Namespace

Drupal\social_event_an_enroll\Controller

Code

public function enrollDialog(NodeInterface $node) {

  // Fetch the user settings.
  $userSettings = $this->configFactory
    ->get('user.settings');
  $action_links['login'] = [
    'uri' => Url::fromRoute('user.login', [], [
      'query' => [
        'destination' => Url::fromRoute('entity.node.canonical', [
          'node' => $node
            ->id(),
        ])
          ->toString(),
      ],
    ])
      ->toString(),
  ];

  // Check if users are allowed to register.
  if ('admin_only' !== $userSettings
    ->get('register')) {
    $action_links['register'] = [
      'uri' => Url::fromRoute('user.register', [], [
        'query' => [
          'destination' => Url::fromRoute('entity.node.canonical', [
            'node' => $node
              ->id(),
          ])
            ->toString(),
        ],
      ])
        ->toString(),
    ];
  }
  $action_links['guest'] = [
    'uri' => Url::fromRoute('social_event_an_enroll.enroll_form', [
      'node' => $node
        ->id(),
    ], [])
      ->toString(),
  ];
  return [
    '#theme' => 'event_an_enroll_dialog',
    '#links' => $action_links,
  ];
}